asp.net how to bind List<model> data to gridview?
In my linq method it returns List as query result. The model is generated based on the fields of data table. E.G it has three fields model.id, mo开发者_如何学编程del.name, model.createTime. If I want to use gridview to display returned data which is in List format. How to do it?
GridView.DataSource = List<Model>
GridView.Databind()
You can set the Datasource property to your data and call Databind to update the grid from your data source.
This would be added to your code behind when the population should occur.
See MSDN.
精彩评论