Mangesh barmate

Mangesh barmate

  • NA
  • 118
  • 136.2k

Change sharepoint 2010 SPGridview cell color on condition?

Dec 3 2012 5:52 AM

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.