C# RowDataBound上Gridview行的背景色在IE11中不起作用
我有C# RowDataBound上Gridview行的背景色在IE11中不起作用,c#,asp.net,rowdatabound,C#,Asp.net,Rowdatabound,我有Grd_RowDataBound,我正在对我的GridView行应用背景色。我使用了下面的代码,它在Crome和Mozilla中运行良好,但在IE11中运行不正常 protected void Grd_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string Sta
Grd_RowDataBound
,我正在对我的GridView行应用背景色。我使用了下面的代码,它在Crome和Mozilla中运行良好,但在IE11中运行不正常
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
}
}
}
请帮助。尝试以下方法:
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";
}
}
}
希望这对你有帮助