We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to perform Undo/Redo operation in GridGroupingControl?


GridGroupingControl does not support the Undo or Redo architecture that is provided by the GridControlBase.


When you want to use the Undo or Redo support, you can add custom commands derived from the abstract GridModelCommand, to manage the actions you want to support. The attached sample shows one way to handle undo or redo on the user changed values.

  1. Creating a Custom Command Class:

A class GGCValueChangedCmd is created and inherited from the GridModelCommand class.



  1. Working with CommandStack

The TableControlCurrentCellValidating is used to cache the old value. TableControlCurrentCellAcceptedChanges event is used to create an instance of the custom command and push it on the CommandStack.



  1. Performing Undo/Redo operation

The Undo or Redo operations are performed by using buttons. UndoStack and RedoStack of CommandStack are used to retrieve the old or new values accordingly, to perform the undo or redo operation. The Execute() method of GridModelCommand is overridden for reassigning the values to a record. A helper method SwapValues() is used to swap the old or new values.




Sample Links

CS: Undo_Redo

VB: Undo_Redo

Article ID: Published Date: Last Revised Date: Platform: Control:
719 04/30/2011 02/12/2016 WinForms GridGroupingControl
Did you find this information helpful?
Markus Persson Oct 04, 2016
This does not work if you have TableOptions.AllowSelection set to GridSelectionFlags.Any
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon