0
Reply

Change sharepoint 2010 SPGridview cell color on condition?

Mangesh barmate

Mangesh barmate

Dec 3 2012 5:52 AM
1.3k

I have a sharepoint 2010  SPGridview and i want to change its cell color on one condition.My condition is

string strRemoveDollar = e.Row.Cells[12].Text.ToString();

decimal theValue = Convert.ToDecimal(strRemoveDollar); 

                    if (theValue < 17) {

                        e.Row.Cells[12].BackColor = Color.Red;   }

                    else if (theValue < 10) {

                        e.Row.Cells[12].BackColor = Color.Green;  }


How i  accomplish this, where to put code so my cell color gets change on condition provided.