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

Conditional formatting for cells

Can I do conditional formatting for individual cells in a Syncfusion grid grouping control. I dont want to format the whole record, just the individual cell based on a certain condition.

1 Reply

LS Lingaraj S Syncfusion Team May 23, 2009 06:27 AM UTC

Hi Abhinav,

Thank you for your interest in Syncfusion product.

In GridGroupingControl the cell formatting done through the GridTableCellStyleInfo. If you need to format the cell, then please try using GridTableCellStyleInfo or Style property in QueryCellStyleInfo event to achieve this behaviour.

Please refer the code below:

// through GridStyleInfo
GridTableCellStyleInfo style=this.grid.TableModel[1, 2];
style.BackColor=Color.Red;
style.TextColor=Color.Yellow;
// through WueryCellInfo
this.gridControl1.QueryCellStyleInfo += new GridQueryCellInfoEventHandler(grid_QueryCellStyleInfo);
void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.TableCellIdentity.RowIndex == 2 && e.TableCellIdentity.ColIndex == 5)
{
e.Style.BackColor=Color.Red;
e.Style.TextColor=Color.Yellow;
}
}


Let me know if it helps.

Regards,
Lingaraj S.

Loader.
Live Chat Icon For mobile
Up arrow icon