Bill Software Engineer
Bill Software Engineer

Reputation: 7822

What is the easiest way to display a table of data?

Coming from PHP background. What would be the easiest (best?) way to display a table of data populated in C#? The format of the data could be modified as required, right now, I am thinking 2D list to store the data.

Gridview is nice and all but I haven't found a way to use a C# List as it's data source.

No real feature is required. I can implement my own editor / inserter, etc.

Upvotes: 0

Views: 2887

Answers (2)

SoftBuilders Pk
SoftBuilders Pk

Reputation: 109

DataTable could be another best option as it can support the specific columns of the table or you can manage the whole table in the DataTable DataTable dt=new DataTable(); now you can store your table from the database into this and can use it as a data source for your listview or gridview

Upvotes: 0

Paddy
Paddy

Reputation: 33867

Gridview is what you need. To bind to a list, you just set the list as the datasource and away you go:

List<x> myList = GetList();

myGrid.DataSource = myList;
myGrid.DataBind();

Or use an ObjectDataSource control on the page instead...

Upvotes: 2

Related Questions