I want to change a particular row color of gridview based on some condition, I am using ASP.NET with c#. Thank you.
\\loop throgh all rows of the grid view
if (GridView1.Rows[i - 1].Cells[4].Text.ToString() == "value1")
{
GridView1.Rows[i - 1].ForeColor = Color.Black;
}
else if (GridView1.Rows[i - 1].Cells[4].Text.ToString() == "value2")
{
GridView1.Rows[i - 1].ForeColor = Color.Blue;
}
else if (GridView1.Rows[i - 1].Cells[4].Text.ToString() == "value3")
{
GridView1.Rows[i - 1].ForeColor = Color.Red;
}
else if (GridView1.Rows[i - 1].Cells[4].Text.ToString() == "value4")
{
GridView1.Rows[i - 1].ForeColor = Color.Green;
}