views:

113

answers:

2

How to Add Number Rows to a grid view dynamically using c# asp.net

+1  A: 

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.

Andy West
+1  A: 

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.

slugster