This is very simple task. We can make use of the RowDataBound event handler.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text == "pass")
{
e.Row.Cells[2].ForeColor = System.Drawing.Color.Green;
}
else if (e.Row.Cells[2].Text == "Fail")
{
e.Row.Cells[2].ForeColor = System.Drawing.Color.Red;
}
}
}
Refer:
Dynamically change text color in gridview in asp.net C#