Can I Use List<> Collection Instead of Using Dataset?
My question is can i use List<> instead of dataset or datatable in asp.net using c#?Can by any means i use list<> than bind it to my gridview instead of datatable/dataset?Thank you?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek JainPosted Sep 13, 2013, 3:08 AM
Create a Enitity for your Data Model or the Table
Then create a List
No give this list as a data source to the grid and the PropertyNames in this entity can be the name of the DataField in Bound Fields
Sample Code:
AJ
rachit sharmaPosted Sep 13, 2013, 3:41 AM
Sanjeeb LenkaPosted Sep 13, 2013, 3:09 AM
you can use List instead of dataset/datatable.
refer to this link for example:
http://www.aspsnippets.com/Articles/How-to-bind-GridView-with-Generic-List-in-ASPNet-using-C-and-VBNet.aspx