现在的位置: 首页 > 综合 > 正文

GridView的小技巧–实现鼠标划过改变GridView的行背景色

2013年06月05日 ⁄ 综合 ⁄ 共 304字 ⁄ 字号 评论关闭
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //当鼠标停留时更改背景色
        e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
        //当鼠标移开时还原背景色
        e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
    } 

抱歉!评论已关闭.