Generic collection values Binding

Posted by Sekar.C under C# on 3/15/2012 | Points: 10 | Views : 716 | Status : [Member] | Replies : 6
hi,
how can display Generic collection values in c#

regards
sekar.c

Regards
Sekar.c



Responses

Posted by: Patel28rajendra on: 3/15/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

refer this link nice explanation

http://www.dotnetfunda.com/articles/article152.aspx

Thanks

R D Patel

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/15/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi try this:

List<Employee> list = new List<Employee>(){
new Employee() { FirstName="Himanshu", LastName="Manjarawala", Age=30},
new Employee(){ FirstName="Hetal", LastName="Sangani", Age=26},
new Employee(){ FirstName="Viral", LastName="Sangani", Age=32},
new Employee(){ FirstName="Rajesh", LastName="Patel", Age=29},
new Employee(){ FirstName="Nehal", LastName="Thakkar", Age=30}
};

DataGridView1.Datasource = list;




Mark this as answer, if it helps you..............

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sekar.C on: 3/15/2012 [Member] Starter | Points: 25

Up
0
Down
hi,
i got this error:

Error 1:The type or namespace name 'Employee' could not be found (are you missing a using directive or an assembly reference?)
regards
sekar.c


Regards
Sekar.c

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/15/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi sekar,

to resolve this error, define Employee class:

class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
}


Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sekar.C on: 3/15/2012 [Member] Starter | Points: 25

Up
0
Down
hi,
i got the solution

Regards
Sekar.c

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/15/2012 [Member] Starter | Points: 25

Up
0
Down
If you get the solution mark as answer

R D Patel

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response