Gridview cell not being conditionally formatted

  • Thread starter Thread starter QPR_JAY
  • Start date Start date
Q

QPR_JAY

Guest
I am trying to set the font colour for a particular column if the cell text == "High"
I thought the code I had (below) would do the trick but nothing is happening.
The column in question is the 5th column along. I have checked the underlying data and there are no leading/trailing spaces in the data. The column cell font colour is always black

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[4].Text == "High")
{
e.Row.Cells[4].ForeColor = Color.Red;
}

}
}

Continue reading...
 
Back
Top