Saturday, 30 November 2013

Asp.net GridView example using C#

Below is a sample code snippet for Asp.net GridView example using C#. The code snippet shows how to populate the GridView with a List of Employees.

Asp.net GridView example using C#

ASP.NET WebForms

"GridView1" runat="server">

protected void Page_Load(object sender, EventArgs e)

{

List employees = new List();

employees.Add(new Employee { Name = "Test1", Designtaion = "Software Engineer" });

employees.Add(new Employee { Name = "Test2", Designtaion = "Architect" });

employees.Add(new Employee { Name = "Test3", Designtaion = "Vice President" });

GridView1.DataSource = employees;

GridView1.DataBind();

}

 

No comments:

Post a Comment