Sunday, 1 December 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

Note: only a member of this blog may post a comment.