Asp net datagrid rowupdating
Since you are not using the datasource controls(which is a good thing), the Old Values and New Values collections will not be populated automatically. So, here is some sample code that I use, and maybe it will help you: This goes in your Row Updating event Dim cell As Data Control Field Cell = Nothing 'This type will change if you are using Bound Fields 'The collection(s) have to be populated for EACH cell. Every one can use it to compare the new value with old ones.After searching long and hard I found a great article that solved my issue.update the Grid View but not call the Update method of it’s Data Source until the whole page was being committed.I had to wire up the dirty checking to flag any changes made to the data it contained.
A Grid View Update Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the update operation should be canceled.
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.
The Row Updating event is raised when a row's Update button is clicked, but before the Grid View control updates the row.
Most Web Developers have come across this problem at one time or another, how do I stop someone navigating away from a page if they have not saved any changes they have made?
The answer is that you need to employ ‘Dirty Checking’, basically set a flag when the page data is changed and check it if the user tries to navigate away.