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.

GridGroupingControl Conditional Formatting

Thread ID:

Created:

Updated:

Platform:

Replies:

72077 Feb 29,2008 04:07 PM Mar 20,2018 12:50 AM ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Richard Diehl
Asked On February 29, 2008 04:07 PM

I cannot figure out how to format text color in one cell based on a value in a different cell in the same row.



Administrator [Syncfusion]
Replied On March 3, 2008 12:43 AM

Hi Richard,

Thank you for your patience.

Issue 1: how to format text color in one cell based on a value in a different cell in the same row.

You can able to set the text color in one cell based on a value in another cell in the same row when clicking the Apply Conditions button by using GridGroupingControl1 QueryCellStyleInfo event. The following code snippet is used to achieve this behavior:


protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (Buttonclick == 1)
{
if (e.TableCellIdentity.RowIndex > 3)
{
if (e.TableCellIdentity.ColIndex == 6)
{
FirstCellValue = e.Style.CellValue.ToString();
}

if (e.TableCellIdentity.ColIndex == 7)
{
SecondCellValue = e.Style.CellValue.ToString();
}

if (FirstCellValue.ToString().Length > 0 && SecondCellValue.ToString().Length > 0)
{
if (Convert.ToDouble(FirstCellValue) > Convert.ToDouble(SecondCellValue))
{
if (e.TableCellIdentity.ColIndex == 7)
{
e.Style.TextColor = Color.Red;
}

}
}
}

}

}


Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.1.0.34/72077/main.htm

Please try running the above sample and let me know if this helps.

Regards,
Vishnu.





Dave
Replied On March 12, 2008 03:55 PM

I have only been able to get this to work when I turn "Auto Format" off. I would prefer to leave "Auto Format" on and then override the targeted cells. Can you please tell me how to do this?




Dave
Replied On March 12, 2008 08:02 PM

Please disregard this. I have asked the question under a new thread.

http://www.syncfusion.com/support/forums/message.aspx?&MessageID=72305



>I have only been able to get this to work when I turn "Auto Format" off. I would prefer to leave "Auto Format" on and then override the targeted cells. Can you please tell me how to do this?






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.

;