Hi Asem,
Thanks for your response. The problem is that I'm not using the GridGroupingControl. I'm using the regular GridControl object. There is no QueryCellStyleInfo event for that class.
>Hi AP,
Thanks for the interest in Syncfusion Grid.
You can handle QueryCellStyleInfo event and can change the backcolor of the cell if the value is a negative. You can check the CellValue of the CurrentCell and can set the backcolor if the CellValue is less than 0. Please refer the following code snippet that shows how we can handle QueryCellStyleInfo event to get the this behavior.
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell
|| e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.MappingName == "B")
{
int cellvalue = Convert.ToInt32(e.Style.CellValue);
if (cellvalue < 0)
{
e.Style.BackColor = Color.Red;
//e.Style.Format = "{#,##}";// just a format
}
}
}
}
Please refer the sample in the below link that illustrates the above.
http://websamples.syncfusion.com/samples/Grid.Windows/F73730/main.htmPlease let me know if you have any questions.
Regards,
Asem.