Asp.net GridView example using C#

Published on September 1, 2013 by abundantcode

Filed under ASP.NET

Last modified September 1, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 1.5 (4 votes)

This article have been viewed 8551 times

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

<asp:GridView ID="GridView1" runat="server">

</asp:GridView>

C#

protected void Page_Load(object sender, EventArgs e)

{

List<Employee> employees = new List<Employee>();

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();

}

1 Comment

  1. gopal

    please send me a e-auction site in asp.net

    March 6, 2014 - 3:20 pm – Reply

Leave a Comment


x

You might be Interested in these Posts

How to decode a base64 string in C#?

Here's a sample code snippet demonstrating how you can easily decode a base64 encoded string in C#. ...

How to disable editing of items in a combo box in c#?

When working in Win forms using C# and especially when you use the combo box , you would have notice...

C# Program to find the ASCII Value of a Character

Problem Write a program in Visual C# to find the ASCII value of the input character. How to find t...