In this example, I am going to retrieve values from categories table of Northwind database. Drag a Grid View into the Web Form and assign Data Key Names property with the primary key column i.e. In the gdview_Row Editing and gdview_Row Deleting event, we have used the below code to retrieve categoryid from datakey of Grid View, int catid = int. before that i want just using Find control and casting and then retrieving all lot code. If values are same they could notify user to change the value(give new cell value).
Re-obtaining the List of objects via the utility method along with the index obtained from the event arg parameter is not an option because the List of objects may have changed.
This enables you to provide an event-handling method that performs a custom routine, such as checking the results of the update operation, whenever this event occurs.
A Grid View Updated Event Args object is passed to the event-handling method, which enables you to determine the number of rows affected and any exceptions that might have occurred.
We first of all create a Stored Procedure that gets the Id of an employee as a parameter from the Grid View on whichever row the user clicked. In this event, first we get the datakey value that is the id of an employee of whichever row the user clicked and that id is passed as a parameter to the Stored Procedure. According to the above, in these three operations we use three events of the Grid View for each operation.
Point numbers 2 and 3 are performed after point 1 is performed.1.