|112516||Sep 26,2013 07:51 AM UTC||Oct 4,2013 04:34 AM UTC||ASP.NET MVC (Classic)||1|
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
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.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.
This page will automatically be redirected to the sign-in page in 10 seconds.