在GridView中 鼠标移动到行 该行颜色变换

1.在GridView中 鼠标移动到行 该行颜色变换

步骤1.为GridView添加RowCreated的事件。事件代码如下:

    protected void gv_typelist_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
        e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#99cc00'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
        }
    }

鼠标移动到行的效果:

鼠标移开的效果:

原文地址:https://www.cnblogs.com/gaonengquan/p/1351683.html