There are two ways:
1.
<asp:gridview id="GridView1" runat="server" cellpadding="4" forecolor="#333333" xmlns:asp="#unknown">
GridLines="None" onrowdatabound="GridView1_RowDataBound">
<alternatingrowstyle backcolor="green" />
<rowstyle backcolor="Red" />
2.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControlRowType.DataRow)
{
DataRow dr = (DataRow)e.Row.DataItem;
if(dr["id"].ToString() == "1")
{
e.Row.CssClass = "redBackground";
}
else
{
e.Row.CssClass = "greenBackground";
}
}
}