how to using generic collection and develop asp. net application

Posted by Gow.Net under ASP.NET on 5/3/2012 | Points: 10 | Views : 1672 | Status : [Member] | Replies : 2
how to using generic collection and develop asp. net application? please any one give example coding and explanation

gowthaman8870226416


Responses

Posted by: Sabarimahesh on: 5/3/2012 [Member] Bronze | Points: 25

Up
0
Down
To use generic list , add new aspx page
Drag one grid view in body part of page.
On Page_Load Event use below code.
Here we are declaring Generic List by List<String> lst = new List<string>();
Add one data in lst variable, like lst.Add("First");
Set Grid View DataSource to lst variable,like GridView1.DataSource = lst;

 protected void Page_Load(object sender, EventArgs e)  

{
if (!IsPostBack)
{
//Creating Variable List
List<String> lst = new List<string>();
//Adding Data
lst.Add("First");
lst.Add("Second");
//Setting with DataSource to GridView Control
GridView1.DataSource = lst;
GridView1.DataBind();
}
}


Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 5/3/2012 [Member] Bronze | Points: 25

Up
0
Down
http://www.dotnetcurry.com/ShowArticle.aspx?ID=245

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response