Hi,
Let your ID is in Column(1) of the GridView and you want to change the Backcolor of all rows having ID as "3"
why don't you try this.
protected void GridView1_DataBound(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GridView1.Rows)
{
if (gvr.Cells[1].Text == "3"){
gvr.BackColor = System.Drawing.Color.Beige;
}
}
}
or
you can change back color of gridview using rowdatabound event as follows
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.BackColor = Color.Blue;
}
Moreover, apart from rowdatabound event, you can also change backcolor of grid after binding it with data as follows
for (int i = 0; i < gv.Rows.Count; i++)
{
gv.Rows[i].BackColor = Color.Pink;
}