Updating a gridview
In this method again, I am getting the primary key value using Data Keys property of the Grid View and using it to delete the records from the database.After successfully deleting records, again I am calling Bind Data() method to rebind the Grid View.I have specified Data Key Names as Auto ID, the primary key of the database table.Then I have several methods attached with following events Get video of hundreds of ASP. On Row Editing - Edit Record On Row Cancel Edit - Cancel Record On Row Updating - Update Record On Row Deleting - Delete Record As I set Auto Generate Columns property to false so I am going to manually write the fields name that I need to appear in the way I want.When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.In this method, I am specifying the Edit Index property of the Grid View to the New Edit Index of the Grid View and then calling Bind Data() method again to bind the data.
I got a gridview and there is hyperlink column which says update.
In this article, I am going to explain how to manipulate data using Grid View control.
This article scope is limited to Updating and Deleting records using Grid View and I am not using any readymade Data controls for that but manually writing all event methods.
To get the Primary key, I have used Data Keys property of the Grid View with the index of the row, being edited and stored into a integer variable after parsing.
Now I have declared a Grid View Row variable named row and stored the current row being edited into it.