protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
{
DataRowView drv = (DataRowView)e.Row.DataItem;
if ((e.Row.RowType == DataControlRowType.DataRow) || (e.Row.RowType == DataControlRowType.Footer))
{
if (drv != null)
{
if (drv["arttype"].ToString().Trim() == "A") //條件式
{
e.Row.Attributes.Add("style", "background-color:#f0d5b3"); //新增背景色屬性
}
}
}
}
12 }
13 }
14 }
[ASP.NET] GridView 依條件更改某列背景顏色
最新推荐文章于 2023-09-07 18:55:39 发布