4

I have Grd_RowDataBound and I am applying back color to my GridView Rows. I have used below code which is working fine in Crome and Mozilla ,but not working in IE11.In IE11 my Gridview row back color is not working.

protected void Grd_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string Status = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Visit_Status"));

            if (Status == "1")
            {
                e.Row.BackColor = ColorTranslator.FromHtml("#28b779");//81F79F
            }
            else
            {
                e.Row.BackColor = ColorTranslator.FromHtml("#da5554");//F78181
            }
        }        
    }

Please help.

Krupa Patel
  • 3,309
  • 3
  • 23
  • 28
Genish Parvadia
  • 1,437
  • 3
  • 17
  • 30

1 Answers1

2

Try something like this:

protected void Grd_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string Status = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Visit_Status"));

            if (Status == "1")
            {
                e.Row.Attributes["style"] = "background-color: #28b779";
            }
            else
            {
                e.Row.Attributes["style"] = "background-color: #da5554";
            }
        }        
    }

Hope this may help you!

Krupa Patel
  • 3,309
  • 3
  • 23
  • 28