GridView设置某一行为特定颜色

ASP.NET 可以对GridView中某一行设置特定颜色,通过判断其中列Updated是否为空。

 1     protected void GridViewSalesGroup_RowDataBound(Object sender, GridViewRowEventArgs e)
2 {
3 if (e.Row.RowType == DataControlRowType.DataRow)
4 {
5 string updatedDate = (string)DataBinder.Eval(e.Row.DataItem, "Updated");
6 if (updatedDate == "")
7 {
8 e.Row.BackColor = System.Drawing.Color.LightPink;
9 e.Row.ForeColor = System.Drawing.Color.Maroon;
10 }
11 }
12
13 }
原文地址:https://www.cnblogs.com/zhoukaiwei/p/2252648.html