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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Expressions of conditional formatting

Thread ID:





80386 Apr 1,2009 02:57 PM UTC Apr 2,2009 03:40 PM UTC ASP.NET Web Forms (Classic) 2
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On April 1, 2009 02:57 PM UTC

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?


Rekha P [Syncfusion]
Replied On April 2, 2009 12:08 PM UTC

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";
e.Row.Cells[i].Text = "Not Equal";

Please refer the sample below which illustrates the above.

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.


Peter Kovacs
Replied On April 2, 2009 03:40 PM UTC


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



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon