Is there a way I can tell which cell caused AfterRowUpdate to fire?
Thanks.
I think this could be several cells and also without any cell update. AfterRowUpdate does not mean that a cell data has been changed, but that the row data was committed to the data source. You can use AfterCellUpdate for that.
So, what you are saying is that the AfterRowUpdate only means that row data was committed to the data source, and if I wanted to know what cell, if any caused the update, trap AfterCellUpdate?
Then, AfterCellUpdate will always fire after AfterRowUpdate?
Mike Malter said: So, what you are saying is that the AfterRowUpdate only means that row data was committed to the data source, and if I wanted to know what cell, if any caused the update, trap AfterCellUpdate?
Yes.
Mike Malter said: Then, AfterCellUpdate will always fire after AfterRowUpdate?
I'm not sure. You can debug and see.
After CellUpdate fires when you update a cell, so it fires before AfterRowUpdate.
If you want to know which cell(s) in the row changed, then you can't get that from the grid in AfterRowUpdate, because at that point, the changes have already been written to the data source and the grid doesn't have any reason to track the changes after that.
You could use BeforeRowUpdate and compare the values in the cells of the row to the values in the DataSource row (which you can get via the ListObject property of the grid row).
Mike,
Understood.
Am adding functionality in a system I did not create, and everything leads me to AfterRowUpdate where some buttons are turned off. I don't want them turned off if a certian column is clicked (which was handled in the cell update, but also duplicated in the row update event).
The original developer is then comparing the data source for the grid with the grid and if there are differences in the data source, he is updating the grid, which is causing AfterRowUpdate to fire multiple times.
I had to look at the code several times to finally understand what was going on. I am looking at the DataRowVersion.Original and am comparing changes to current data source to figure out what column caused the change.
Thanks to everyone who stepped up to help. I really appreciate it.