You can write the necessary logic in RowDataBound event to change row background color based on condition, something like following-
protected void MyGridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int ID = Convert.ToInt16(DataBinder.Eval(e.Row.DataItem, "ID"));
if (ID == 1 OR ID == 3 OR ID == 4)
{
e.Row.Attributes["style"] = "background-color: #008000";
}
}
}
Hope, it helps :)