简体   繁体   中英

Adding rows to gridview dynamically

如何使用c#asp.net将数字行动态添加到网格视图

To do this, add rows to the data source to which the grid is bound.

Here's an example.

Edit: The link I posted adds a row without adding to the data source. It seems kind of kludgey to me, but it may be more like what you're looking for.

Add new "rows" to the datasource of the grid. If your datasource is a DataTable, then add a new DataRow to the DataTable. If your datasource is a collection of objects, then add a new object to that collection.

Don't forget to rebind the grid once you have updated the datasource.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM