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?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: February 12, 2016
Tags: undoredo


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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
Markus Persson
Oct 04, 2016
This does not work if you have TableOptions.AllowSelection set to GridSelectionFlags.Any Reply

Please sign in to access our KB

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

Up arrow icon

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