Notice that, we have taken a hidden field just in the same column we have the link button and have it default value of out primary key field.
Now on Row Command Event of the grid view write the following code I guess code does not need any explanation, so let’s move on to the next approach.
The Grid View does know the events that should be used to implement them, so the exceptions shown above are thrown when you try to perform one of these operations, but you have implemented the appropriate event handler.
The example shown here is for a Grid View, but the same types of event handlers must be implemented in roughly the same way for other data controls including the Form View, Details View, and List View. This is the final Grid View markup, so you can see the event handlers we’re going to implement.
Approach 2 We have a minor change the in Template Field of the Gridview we write in So, we have remove the hidden field we have added in the last approacha and simply add the command argument to the link button, now to catch the command argument and send it to edit form write the following code on Row Command Event Approach 3: Ok, for this you need to add Data Key Names Property to main Grid View Markup.
Solution: Well, we can achieve this task from variety of methods.What seems to happen is 'Grid View1_Row Updating' gets fired, at this point new English, new French, and new German all have the new values as they are passed into 'Logic. Then the update functions updates correctly, but once the 'Grid View1_Row Updating' sub ends, it seems to call Logic. Update another time, and this is where the new values get lost for French and German (datakeys) but not English. Edit Index = -1 'set to no selection Bind Grid View() End Sub One issue I ran into while attempting to figure this all out was if I didn’t rebind my Grid View at the end of each event, I was required to click twice to get it to select the correct row, and if I clicked around, it would always be a row behind. This blog is for nothing else than to try and help me help you and help you help me and us help everyone else try to fix anything and everything we can’t figure out with this language. 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.Protected Sub Grid View1_Row Updating(By Val sender As Object, By Val e As System.