How to get the datakeynames value in the rowupdating event
After searching long and hard I found a great article that solved my issue.Take a look at the page load if you are binding on post back then the values get updated before you are able to access them.Delete a Record We can delete a record from the database table by clicking on the delete button that is in the Delete column of the Grid View.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.
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. 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. the good old problem of getting the data from the row that is being currently edited within a Grid View. Accessing the "Controls": This method gets you access to the control in the Grid View, which might be useful based on what you are doing.Follow this link for more details --While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.event is raised when a row's Edit button is clicked, but before the Grid View control enters edit mode.