For this scenario, I suggest you modifying only the items of RadGridView that have been modified, rather than populating all items of the control on each undo operation. This can be achieved through the RowEditEnded
event, as its GridViewRowEditEndedEventArgs
expose an EditedItem
property, as well a OldValues
Basically, if you need to perform an undo operation only for the last edited item, you can hold a reference to a single instance of your business model and set its properties based on the property values present in the OldValues
collection within the aforementioned event handler. When the user performs an undo operation, you should be able set the values of the last edited item to be its old ones, as demonstrated in the How to undo changes after RowEditEnded
If such requirement is needed for a collection of modified items, you can simply modify the suggested approach by using a collection of the last edited elements, iterate through them and undo the values of the relevant items present within the Items
collection of RadGridView.
Hope this helps.
All the best,
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items