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.
Unfortunately, activation email could not send to your email. Please try again.

Conditional formatting for cells

Thread ID:

Created:

Updated:

Platform:

Replies:

81364 May 19,2009 12:14 PM May 23,2009 02:27 AM Windows Forms 1
loading
Tags: GridControl
Abhinav Sarvaiya
Asked On May 19, 2009 12:14 PM

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.

Lingaraj S [Syncfusion]
Replied On May 23, 2009 02:27 AM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;