GGC Remember old cell value

Hi

Is their a built in function to know or even remember the value of a cell in the grid?
I would also need to know if there is something like row state filter or a way to know if a cell value has changed

Thanks
Francois


1 Reply

AD Administrator Syncfusion Team May 9, 2008 02:20 PM UTC

Hi Francois,

Thanks for the interest in Syncfusion products.

You can remember the value of the cell in a grid when the cell is validating. You can use CurrentCellValidated event to know if a cell value has changed. Please refer the following code snippet that shows how we can achieve this behavior.


private void gridControl1_CurrentCellValidated(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
string newValue = cc.Renderer.ControlText;
string oldValue = this.gridControl1[cc.RowIndex, cc.ColIndex].Text;
if (oldValue != newValue)
{
if(MessageBox.Show("[Value Changed to]: " +newValue + " [OldVaue ]: "+ oldValue+" \n\nWant to Save ?" ,"Validating Cells" , MessageBoxButtons.YesNo,MessageBoxIcon.Warning) ==DialogResult.Yes)
{
this.gridControl1.EndUpdate();
}
else
{
cc.RejectChanges();
this.gridControl1[cc.RowIndex, cc.ColIndex].Text = oldValue;
this.gridControl1.EndUpdate();
}
}
}


Please refer the sample in the below link that illustrates the above.

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

Please let me know if this is not what you needed.

Regards,
Asem.



Loader.
Up arrow icon