Updating row in gridview

03 Mar

For example if you have Sql Data Source1 as your Grid View data source, your Row_Deleting event would be: When you call Gridview1. As you are doing a databind operation immediately after, without updating the datasource, you are re-adding all the rows from the source to the gridview control (including the row removed from the grid in the previous statement). Here's an example- protected void Grid View1_Row Deleting(object sender, Grid View Delete Event Args e) { int index = Grid View1. Data Bind() you will populate your gridview with the current datasource. To simply delete from the grid without a datasource then just call the delete operation on the grid and that is all you need to do... So, it will delete all the existent rows, and it will add all the rows from Customers Sql Data Source.

updating row in gridview-4

Maybe you named it different Customers Sql Data Source.

Execute Non Query(); I know this is a late answer but still it would help someone in need of a solution.

In the template field I will Place a label or some controls, So that it’s very easy to access those controls in the code behind by using Find Control method. Item Template is the content to display for the items in the Template Field.

Hi, In row command if you want to get the current row or its index, It is not directly possible.

There is two way, one is on row created event on the link button(suppose, it is used for row command) save row index in link button command argument attribute.