zoukankan      html  css  js  c++  java
  • C# GridView 给某行或某列绑定点击事件和鼠标事件

     protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
       {
           if (e.Row.RowType == DataControlRowType.DataRow)//判断单击行是否为数据行  
             {  
                  DataRowView row = (DataRowView)e.Row.DataItem;  
                  e.Row.ID = GridViewEx1.DataKeys[e.Row.RowIndex]["ID"].ToString();//ID为唯一能够标识一条记录的字段  
                  if (e.Row.ID != null && row != null)  
                  {  
                     e.Row.Cells[1].Attributes.Add("ondblclick", "window.open('ParhelionRestEdittPage.aspx?index=" + (e.Row.RowIndex + 1).ToString() + "&id=" + e.Row.Cells[0].Text.Trim() + "',null,'width=400,height=108,left=300,top=200');");
    
                     e.Row.Cells[1].Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F89E14',this.style.cursor='pointer';");  
                      //鼠标事件 this.style.backgroundColor='#F89E14' 列背景色  this.style.cursor='pointer' 鼠标放上去样式  
                     e.Row.Cells[1].Attributes.Add("onmouseout", "this.style.backgroundColor='';");  
                  }  
               }  
            }
        }
    

      

  • 相关阅读:
    linux下ssh端口的修改和登录
    linux找回密码
    XAMPP命令之LAMPP
    VirtualBox 复制vdi文件和修改vdi的uuid
    探讨PHP页面跳转几种实现技巧
    CSS盒模型和margin重叠
    8--数组旋转
    9--斐波那契数列
    7--动态规划
    6--树的遍历
  • 原文地址:https://www.cnblogs.com/lgx5/p/8392449.html
Copyright © 2011-2022 走看看