根据行里面的某项值判断该行的背景色

来源:互联网 发布:金融期货交易软件 编辑:程序博客网 时间:2024/06/14 06:53

只需在绑定函数如下即可:


protected void GV_show_RowDataBound(object sender, GridViewRowEventArgs e)
    {


        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string str = e.Row.Cells[2].Text.Trim().ToString();
            if (e.Row.Cells[2].Text.ToString() == " ")
            {
                e.Row.BackColor = Color.DarkRed;
            }
            
        }
        


    }