Dear Friend,
This change of color can be achieved in the GridRowDataBound event. As the Data is being bound to the GridView, a
GridView1_RowDataBound evetn is fired which binds each row with data in the DataTable or DataSet object bind to the Grid.
Here on the basis of your condition you can change the coor of different rows accordingly. For e.g.
protected void DrugGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType = DataControlRowType.DataRow)
{
If((UserID = Session["UserAuthentication"].ToString()))
{
e.Row.BackColor = Drawing.Color.Red
}
}
}
Here the Row containing the Employee ID from th DataTable Or DataSet can be checked against the Session Employee ID (from login as per your question). If the Condition matches then the Row color can be changed accordingly as required.
For your reference :-
change-gridview-row-color-based-on-condition-in-c-sharp
Please don't forget to mark this as your answer if it helps you out.
Regards
Varun Sareen