温州布衣

实现审核状态显示,选中行颜色变化功能。

                               效果图——

实现审核状态显示,并选中行颜色变化功能。

 

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {

                //高亮显示指定行

                e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='#31cb29'");

                e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;");

                //设置审核状态,并且设置相应的颜色

                if (e.Row.Cells[5].Text == "False")
                {
                    e.Row.Cells[5].ForeColor = Color.Red;
                    e.Row.Cells[5].Text = "未审核";
                }

                else
                {
                    e.Row.Cells[5].ForeColor = Color.Blue;
                    e.Row.Cells[5].Text = "已审核";
                }

            }

        }

posted on 2009-03-20 10:49  温州布衣  阅读(746)  评论(0)    收藏  举报