When we edit a row in our Grid View and press the “Update” button, at some time it’s received in the Row Updating method.
But as I noted in the comments in that method, some collections that should contain the columns (names, old values and new values) are always empty. And the Row Updated method is never even touched!!! NET Forums that I need to use a Data Source control.
So when we change the Command Name property of the buttons to some other text then it will work fine.
Some other Grid Views reserved key words and their default associated events are as follow : “Cancel” – Raises the Row Canceling Edit event.
In the event handler function I have checked for the Command Name property and write necessary code for each of the actions.
The HTML code for the Grid View is as follow : Till now everything looks fine but the problem arises when you run this application.
To avoid this we need to keep the property Read Only as false, Then in the edit mode nothing will happenes. The reason I use Template Field instead of Bound Field is that, it is very easy to grab those controls in the codebehind if we user labels or textboxes.
In case of the bound field’s we need to check what column it is and need to use index of that cloumn, which is little hard and even in future if we change the column order If you see the Last Template Field part in the above code, I am using the link buttons for edit, update, delete and cancel.
Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.For a while now I’m trying to figure out why my method, triggered by the Grid View.Row Updating event, doesn’t work as all samples say it should do.Then again we have to call that Bind Grid Data () method to bind data for the textboxes. You can leave a response, or trackback from your own site.So once after done with editing data, if we click update the following method will be triggered. Once we access the required fields in the code behind, we need to update the data in the database and show the updated data to the user. If the user clicks the Delete button On Row Deleting event will be fired. Going into that code we are trying to get the primary key of the employee table(Employee ID) by using Grid View Data Key Names and then This entry was posted on March 27, 2009 at am and is filed under ASP. The exact situation I faced is like this – I have a Grid View with a column which contains an edit button.