Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background color of Gridview row on RowDataBound is not working in IE11

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.

like image 534
Genish Parvadia Avatar asked Oct 20 '22 02:10

Genish Parvadia


1 Answers

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!

like image 111
Krupa Patel Avatar answered Oct 22 '22 18:10

Krupa Patel