zoukankan      html  css  js  c++  java
  • DataGrid和GridView鼠标移动上面背景变色

    GridView鼠标移动背景变色,在RowDataBound事件中添加如下代码:

       protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "javascript:c=this.style.backgroundColor;this.style.background='#B0E0E6';");
                e.Row.Attributes.Add("onmouseout", "javascript:this.style.background=c;");
            }
        }

    DataGrid鼠标移动背景变色,在ItemDataBound中添加如下代码

        protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                e.Item.Attributes["onMouseOver"] = "javascript:c=this.style.backgroundColor;this.style.background='#B0E0E6';";  //current 粉蓝色 //--#6699ff 蓝色 #FFFF00 黄色 #FFFFE0 亮黄色
                e.Item.Attributes["onMouseOut"] = "javascript:this.style.background=c;";
            }
        }
  • 相关阅读:
    动态页面技术(JSP/EL/JSTL)
    JavaWeb核心之Servlet
    会话技术Cookie&Session
    待整理
    二进制中1的个数(python)
    矩形覆盖(python)
    变态跳台阶(python)
    跳台阶(python)
    斐波那契数列(python)
    旋转数组的最小数字(python/c++)
  • 原文地址:https://www.cnblogs.com/52net/p/2521329.html
Copyright © 2011-2022 走看看