depending up on x and y condition , changing the background color of the row
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { // check your condition here if (e.Row.RowType == DataControlRowType.DataRow) { string strValue = DataBinder.Eval(e.Row.DataItem, "SomeColumn").ToString(); //do something with the values and set color switch (strValue) { // change row color case "Something 1": e.Row.BackColor = System.Drawing.Color.Red; break; case "Something 2": e.Row.BackColor = System.Drawing.Color.Yellow; break; case "Something 3": e.Row.BackColor = System.Drawing.Color.Violet; break; case "Something 4": e.Row.BackColor = System.Drawing.Color.Teal; break; } } }
Have a nice day... 'N happy Coding :)
No comments:
Post a Comment