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.

Expressions of conditional formatting

Thread ID:

Created:

Updated:

Platform:

Replies:

80386 Apr 1,2009 10:57 AM Apr 2,2009 11:40 AM ASP.NET Web Forms (Classic) 2
loading
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On April 1, 2009 10:57 AM

Hi guys,

I want to use conditional formatting using GridConditionalFormatDescriptor class, however I could not find any documentation about its Expression property.
I tried to assign a condition where values of two columns are equal but it didn't work:

GridConditionalFormatDescriptor formatDesc = new GridConditionalFormatDescriptor();
formatDesc.Name = "xy";
formatDesc.Expression = "[Col1]=[Col2]";

How can I make this work?

Also, how can I use one of the members of column's ExtendedProperties collection in this expression?

Thanks,
Peter


Rekha P [Syncfusion]
Replied On April 2, 2009 08:08 AM

Hi Peter,

Thank you for your interest in Syncfusion Products.

If your intension is to check for a condition between two columns, you can use RowDataBound event which iterates through each row with the grid cells. Please refer the code
snippet below to achieve this.


void GridGroupingControl1_RowDataBound(object sender, RowDataBoundEventArgs e)
{
//Check if the current element is a Record row.
if (e.Element.Kind.ToString() == "Record")
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
if (((GridCell)(e.Row.Cells[i])).ColumnDescriptor.MappingName == "Check")
{
GridRow gridrow1 = e.Row;
int a = Convert.ToInt32(gridrow1.Record.GetValue("Value1")); //Col1
int b = Convert.ToInt32(gridrow1.Record.GetValue("Value2")); //Col2
if (a == b)
{
e.Row.Cells[i].Text = "Equal";
}
else
{
e.Row.Cells[i].Text = "Not Equal";
}
}
}
}
}


Please refer the sample below which illustrates the above.
http://files.syncfusion.com/support/GGC.Web/7.1.0.30/F80386/main.htm

The Equal(==) defined in Expression returns true if both arguments have same value, for instance "[Salary]=20000".

We request you to create a DirectTrac Incident using your DT account for further support and please let me know if you have any concerns.

Thanks,
Rekha



Peter Kovacs
Replied On April 2, 2009 11:40 AM

Hi,

thanks for the response, this solution seems to solve my problem. I'll get back to you when I try it.

thanks,
Peter


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.

;