GridGroupingControl change cell color after edit complete

For a GridGroupingControl, after a cell value has been changed, I wish to then change the BackColor of that cell. I'm using the TableControlCellAcceptedChanges event, but
grid.TableModel[rowIndex, colIndex].BackColor = Color.Red; does not seem to have any effect.

Can someone tell me how I can accomplish this?


1 Reply

JJ Jisha Joy Syncfusion Team May 5, 2008 08:02 AM UTC

Hi,


This can be achieved by handling the QueryCellStyleInfo event. Please use the follwing code snippets and let me know if this helps.

void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
Element el = e.TableCellIdentity.DisplayElement;
if (el.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
Record rec = el.GetRecord();
if (rec != null)
{
DataRowView row = rec.GetData() as DataRowView;
if (row != null & row.Row.RowState == DataRowState.Modified)
{
e.Style.BackColor = Color.Pink;
}
}
}

}


Regards,
Jisha


Loader.
Up arrow icon