How can I delete, edit and add rows in a gridview with 3 buttons out of it for deleting, editing and adding rows in C# asp.net and refresh grid after changing?
I don’t want to use the command buttons of the gridview that is repeated in every row.
How can I delete, edit and add rows in a gridview with 3 buttons
Share
You need to select the row some how in order for the code to know which row to delete or edit. Then you can grab the the content of that row on
GridView1_SelectionChangedin order to delete or update it.Edit:
Here is what to do:
1. Drag a gridview and a textbox to page.
2. Populate gridview
3. Override Render
4) In
GridView1_SelectedIndexChangedeventNow you can easily customize this simple example up to your taste.
Edit 2:
Specify the Id as DataKeyName in gridview
Check the updated
GridView1_SelectedIndexChangedto see how to retrieve the id for selected row.