Gridview中修改某列的背景色

Gridview中状态列的值是1,某列的背景是是绿色
状态字段是:archivesStatus
 protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {            
            for (int i = 0; i <= gvInfo.Rows.Count ; i++)
            {                
                string bqred = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "archivesStatus"));
                if (bqred == "1")
                {
                    e.Row.Cells[14].BackColor = System.Drawing.Color.Green;
                }                
            }
        }
    }

上一篇:ASP.NET WebAPI 13 Filter


下一篇:C# 6新特性及示例代码