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: How to Change Cell Color on Property value?

Thread ID:





112516 Sep 26,2013 03:51 AM Oct 4,2013 12:34 AM ASP.NET MVC (Classic) 1
Tags: Grid
Suhas Dhongade
Asked On September 26, 2013 03:51 AM

I want to change cell color depending on property value.  this property is not a visible/hided coulmn.

its a asp.net web application.

suppose.. I have bound  List<Emp> and

EMP - name , salary , department, gender

Gender is not any column on the GridGroupingControl. It just a property of EMP(either Male/Female).

Now I want change color of "Name" cell who is belongs to Male value



Shanmugaraja K [Syncfusion]
Replied On October 4, 2013 12:34 AM

Hi Suhas,


Thanks for using Syncfusion products.


Your requirement of changing the cell color depending on  the property value which did not included in hidden/visible columns in Grid  can be achieved by using RowDataBound Event. Please refer to the below code snippet to achieve this.



void GridGroupingControl1_RowDataBound(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.RowDataBoundEventArgs e)


 for (int i = 0; i < e.Row.Cells.Count; i++)


            if (((Syncfusion.Web.UI.WebControls.Grid.Grouping.GridCell)(e.Row.Cells[i])).ColumnDescriptor != null)


                   if (((Syncfusion.Web.UI.WebControls.Grid.Grouping.GridCell)(e.Row.Cells[i])).ColumnDescriptor.Name == "Name")


                      if ((e.Row.Record!=null) && (e.Row.Record.GetValue("Gender") == "Male"))


                          e.Row.Cells[0].BackColor = Color.Green;




Please refer to the attached sample application for further reference.


Please get back to us if you need further assistance.






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.