Undo/Redo in a GridControl

Hello,

I am using a syncfusion GridControl and have set gridControl1.Model.CommandStack.Enabled = true; yet I am not able to implement undo /redo after editting a cell in the grid.
How should i go about implementing the same?

1 Reply

AD Administrator Syncfusion Team October 24, 2007 05:55 PM UTC

Hi Keshav,

Thank you for your interest in Syncfusion products.

To enable Undo/Redo for the current cell in the GridControl , please try setting the following codesnippet.

[C#]
this.gridControl1.CommandStack.Enabled = true;


private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Z && ((e.Modifiers & Keys.Control) != 0))
{
if (this.gridControl1.CurrentCell.IsEditing)
{
this.gridControl1.CurrentCell.EndEdit();
this.gridControl1.CommandStack.Undo();
}
}

Please refer the sample that illustrates the same.

http://websamples.syncfusion.com/samples/Grid.Windows/F69291/main.htm

Please let me know if you have any other queries.

Regards,
Jaya

Loader.
Up arrow icon