GridView鼠标经过行变色

        设置OnRowDataBound="gvUserList_RowDataBound"

       protected void gvUserList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //判断是否是DataRow,以防止鼠标经过Header也有效果 
            if (e.Row.RowType == DataControlRowType.DataRow) 
            {
                e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c8dafa'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
            }
        }
posted @ 2007-08-02 12:22  scgw  阅读(1220)  评论(1编辑  收藏  举报