I'm attempting to use the Row.DataChanged property to control updates to our database, but I must not full understand how it works. Any suggestions would be appreciated.
We bind a dataset to a grid and display it. The user is allowed to make changes (modify, add, delete). When the user has finished, they click a Save button. The Save button server-side implementation does the actual database updates. We don't want to update the database until Save is clicked.
The Save implementation iterates over Grid.Rows looking at DataChanged for each row. This works fine for Unchanged, Added and Modified rows. However, Deleted rows are gone from Grid.Rows so we can't capture those changes. The documentation for DataChanged seems to indicate that all four row states should be possible.
What am I missing? Do Deleted rows only show up for certain types of data sources? Do Deleted rows ever show up? I'd really like to avoid caching the data to determine what was deleted, but that seems like the next step. Any other suggestions?
Thanks,
DaveL
I would suggest that probably the best way to do this would be to handle either the DeleteRow or DeleteRowBatch events. You could either do the deletions directly in those event handlers, or use them to build a list of keys to do your deletion in the Save button click handler.
Iterating over the entire Rows collection probably isn't the most efficient way of handling inserts and updates either...
Were having the same issue. Why even have DataChanged.Deleted if you can't check for it?
We tried implementing the RowBatch events but they fire no matter what postback is occuring. There are times when we perform a postback when we don't want grid changes to be persisted. We have a "Cancel" button for instance. If the user clicks cancel, we do a postback to reload the page. In this instance, the RowBatch events are fired. In our case, it is more efficient to loop the grid rather than having non-saving postback events fire off these events.
All postbacks are fired from either a UltraWebMenu or a UltraWebToolbar click. Unfortunately, the postback events of the UltraWebMenu and UltraWebToolbar happen after the RowBatch events have fired so we can't figure out how to identify which UltraWebMenu was selected before the RowBatch has fired.