I have a Gridview that displays some data. What im trying to do is if the Command name is edit etc to take the appropriate action.
I managed to get the command name by doing an If statement under the RowCommand event for the datagridview which allowed me to take the appropriate action on each command.
The problem i have come across is im trying to get the SELECTED Rows value from a certain column depending on which command has been selected. So if a user clicked edit on row 15 then i would like to get row 15’s col 5 value. If the user clicked row 10 then it would be row 10, col 5 etc.
How could i do this under the RowCommand event OR any other way to achieve the above?
Thanks
I just read this question, but if you still havent figured it out then what you can do it go to your aspx file and define “OnRowEditing” under gridview. Then go back to code behind file and do something like this:
You also need to define OnRowUpdating and OnRowCancelingEdit and put code for them in your code behind.
This is whats gonna be under OnRowCancelingEdit