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. Image for the cookie policy date
close icon

Grid Undo command.stack virtual grid

Hi,

My gridcontrol for windows forms is not doing the undo functionality.

void GridSaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
{
theGrid.CommandStack.Enabled = true;
if (e.ColIndex > 0 && e.RowIndex > 0)
{
//do something
if (e.ColIndex % 2 == 1)
{
// Convert a CellValue to the desired type using Syncfusion 'Convert' class.
DateTime dttm = (DateTime)GridCellValueConvert.ChangeType(e.Style.CellValue, typeof(DateTime), null);

// Debug.Assert(dttm == (DateTime)e.Style.CellValue);
//do something
}
else
{
// Convert a CellValue to the desired type using Syncfusion 'Convert' class.
float value = (float)GridCellValueConvert.ChangeType(e.Style.CellValue, typeof(float), null);
// Debug.Assert(value == (float)e.Style.CellValue);
//do something
}
}
e.Handled = true;
}

private void UndoCellsToolStripMenuItem_Click(object sender, EventArgs e)
{

if (!this.theGrid.CommandStack.InTransaction)
{
this.theGrid.CommandStack.Undo();
ShowStacks();
}
}

Where should i enable commandstack= true?
My grid's data is first in a middle layer(data array) and then relects in the grid.
So Any changes i make to the grid are reflceted in the data array.

Thank you
SC



1 Reply

AS Asarudheen S Syncfusion Team May 9, 2012 06:12 PM UTC

Hi Smitha,

 

Thank you for your interest in Syncfusion products,

 

The undo operation and the redo operation can be achieved from the CommandStack object of the GridControl, which is retrieved from the table control base.

 

Please refer the UG documentation from the below location:’

 

http://help.syncfusion.com/ug_84/User%20Interface/Windows%20Forms/Grid/default.htm?turl=Documents%2Fmultilevelundoandredo.htm

 

 

Also refer the forum from the below link which show case the implementation of the behavior in virtual grid:

 

http://www.syncfusion.com/support/forums/grid-windows/17487

 

 

Let me know if you have any queries.

 

Regards,

Asarudheen.


Loader.
Live Chat Icon For mobile
Up arrow icon