在GridView中移行变色

      在GridView的事件中增加RowDataBound,在这个事件中首先判断当前行是不是数据行,然后进行变色处理,代码如下所示:

 

if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //鼠标经过时,行背景色变
            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#CC0066'");
            //鼠标移出时,行背景色变
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
        }


 

posted @ 2009-07-18 09:06  iZiYue  阅读(263)  评论(0编辑  收藏  举报
ChinaHDTV.ORG