So the problem I am having is that when I get the Datakey value I am trying to get the values in the controls in the Edit Mode of the current row I am trying to update. I am using the Find Control function to get the values from the editing row so I specifically name the dropdownlists and textboxes so I can access them here.But what happens is that I do get some of the values but they are the original values not the new ones being changed.
event is raised when a row's Update button is clicked, but before the Grid View control updates the row.This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.I found that simple data binding of my Drop Down List in my Grid View to my Sql Data Source was not going to be enough. I would need to set values passed to the Sql Data Source control on the update event, and as part of this I would need to reference the controls contained in the row being updated. Buttons within a Grid View control can also invoke some of the built-in functionality of the control.
To perform one of these operations, set the Command Name property of a button to one of the values in the following table. Sets the Command Argument property of the button to "First", "Last", "Next", "Prev", or a page number to specify the type of paging operation to perform.
w=800" src="https://taditdash.files.wordpress.com/2014/06/debugger-inside-gridview-rowupdating-event.png? w=800&h=359" alt="Debugger Inside Grid View Row Updating Event" width="800" height="359" class="size-full wp-image-328" srcset="https://taditdash.files.wordpress.com/2014/06/debugger-inside-gridview-rowupdating-event.png? w=230" src="https://taditdash.files.wordpress.com/2014/06/gridview-on-browser.png? w=800" alt="Grid View on Browser" class="size-full wp-image-335" srcset="https://taditdash.files.wordpress.com/2014/06/230w, https://taditdash.files.wordpress.com/2014/06/gridview-on-browser.png? w=416" src="https://taditdash.files.wordpress.com/2014/06/gridview-cell-showing-updated-value.png? w=800" alt="Grid View Cell Showing Updated Value" class="size-full wp-image-331" srcset="https://taditdash.files.wordpress.com/2014/06/416w, https://taditdash.files.wordpress.com/2014/06/gridview-cell-showing-updated-value.png?
If we move our mouse on to the variables, which hold the cell values, we can see the old value instead of new updated value (Refer the debugging Screen Shot at the Top).
Thanks The OP has clearly mentioned the Row Updated event but if you'd like to suggest Row Updating - a page-level variable should be enough; beyond a postback a View State variable could be advised for the same page.
I will click on the EDIT link in one of the grid view row. I will update the values and click update link in edit mode and edit mode closes. At this point I need to capture the datakey of the updated row into some variable Can someone please help me out with this?
We can achieve the same functionality using Datakeys.