in RowDatabound event of grid you should be writing this code.
i.e In this event first you should check
protected void grv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header )
{
if (departmentname =="Mechanic")
{
e.Row.Cells[3].Attributes("backgound", "cyan");
}
}
}
HOpe this will work. if there is any problem please let me know.
:cool:
UPDATE:
if (e.Row.RowType == DataControlRowType.Header )
if (e.Row.RowType != DataControlRowType.Header )