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

Cell Style in a Grid Grouping Control

Thread ID:





74099 May 29,2008 07:12 PM UTC Nov 27,2009 10:31 AM UTC ASP.NET Web Forms (Classic) 5
Tags: GridGroupingControl
Rekha Mallavarapu
Asked On May 29, 2008 07:12 PM UTC


I would like to color code the cell in a Grid Grouping control based on data in two different rows. See Attached file:

Here is what I want to do: In the following example if the price of Rice > $1.00 and Wheat > $2.00 then color the value of Rice as Red.

Company food prices ($)
Company X Rice 2
Company X Wheat 3
Company X potates 1
Company X Bread 1.5
Company Y Rice 0.99
Company Y Wheat 2.5
Company Y potates 1
Company Y Bread 1.5
Company Z Rice 4
Company Z Wheat 3.5
Company Z potates 1
Company Z Bread 1.5




Rajarajeswari S [Syncfusion]
Replied On June 28, 2008 06:50 PM UTC

Hi Rekha,

Thanks for your interest in Syncfusion products.

There is no direct way to achieve you requirement. But you can do this by a workaround. Please refer the following steps to be done:

1. We have to loop through the Grid data and access the value of each cell.
2. We have to compare the Rice and Wheat values based on the Comapny
3. Based on the comparision just save the Rice values which are going to be highlighted, in a collection.
4. In QueryStyleCellInfo event just check for the values in the collection and set the BackColor for the particular cell.

Please refer the below code snippet which illustrates this:

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
if ( e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellTypeRecordFieldCell )
if (e.TableCellIdentity.Column.Name == "Price on Jun 1")
foreach (Rice obj1 in ric1)
if (e.Style.Text == obj1.rice1.ToString())
e.Style.BackColor = Color.Red;

if (e.TableCellIdentity.Column.Name == "Price on Jun 2")
foreach (Rice_nxtmnth obj1 in ric2)
if (e.Style.Text == obj1.rice1.ToString())
e.Style.BackColor = Color.Red;


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


Please let me know if you have any other concerns.


Administrator [Syncfusion]
Replied On May 12, 2009 11:50 AM UTC

How to set the border of the cell dynamically.

Rekha P [Syncfusion]
Replied On May 14, 2009 07:07 AM UTC

Hi Girish,

Thank you for your interest in Syncfusion Products.

Border styles can be set through the Borders property, from the QueryCellStyleInfo event. Please refer the below code snipet which illustrates this.

void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
e.Style.Borders.All = new GridBorder(GridBorderStyle.Dashed, Color.Red);
e.Handled = true;

Please refer the sample from the below link which illustrates this.


Please let me know if this helps you.


Chia Jye Kueh
Replied On November 26, 2009 02:55 AM UTC


The sample below seems to only work if we don't use the AutoFormat on the grid


How can I perform the same formatting if my grid is using one of the AutoFormat? (Please refer to the sample attached)



Lakshmi Narasimman G [Syncfusion]
Replied On November 27, 2009 10:31 AM UTC

Hi Chia,

Thanks for your interest in Syncfusion products

We suggest you to handle the GridTableCellStyleInfoEventArgs Property to true in Querycellstyleinfo event

using the below code snippet
when you use AutoFormat style property

Code Snippet:
e.Handled =true;

I have created a sample to illustrate this please check the sample from below link


We recommend you to download our latest version from the below link which has many features


Please check the features of our latest version from the below link


Unlock key:
If your Essential Studio license is valid, you will be able to obtain the key to install this version from
your Direct-Trac account or contact your Syncfusion Sales Representative or e-mail :
salessupport@syncfusion.com for further assistance.

Please let us know if you have any concerns.

Lakshmi Narasimman G.


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

or the page will be automatically redirected to 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