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"
>
"GridView1"
runat=
"server"
>
protected void Page_Load(object sender, EventArgs e)
{
Listemployees = 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.