zoukankan      html  css  js  c++  java
  • GridView如何实现点击某行的指定列弹出新窗体

    在Gridview的rowdatabind事件中添加如下代码:
    protected void GVData_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex > -1) { //循环每列 判断需要添加打开新窗体脚本的列 如果改行任意位置都能打开新窗体 则 直接执行if内代码 将cell改为e.Row foreach (TableCell cell in e.Row.Cells) { if (e.Row.Cells.GetCellIndex(cell) != 0&&e.Row.Cells.GetCellIndex(cell) !=10&&e.Row.Cells.GetCellIndex(cell) !=11) { //模版列 要获取到空间的值 如果是BoundFiled 直接去Text值即可 Label lblId = (Label)e.Row.Cells[0].FindControl("LabVisible"); //弹出新窗体 cell.Attributes.Add("onclick", "window.showModalDialog('../GiveScore/DetailMoonDetailResult.aspx?Id=" + lblId.Text + "','','dialogWidth=700px;dialogHeight=500px')"); } } //鼠标以上的样式 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#c8c7c6'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;"); //鼠标样式 e.Row.Style.Add("cursor", "hand"); }
    记录一下 方便以后查阅。

      

  • 相关阅读:
    8.02_python_lx_day14
    8.02_python_lx_day13<2>
    8.02_python_lx_day13<1>
    7.30_python_lx_day20
    7.29_python_lx_da19
    7.29_python_lx_day12
    Docker镜像
    Docker学习Ⅱ
    Docker学习Ⅰ
    2-3树的插入和删除原理
  • 原文地址:https://www.cnblogs.com/sulei4471/p/2792049.html
Copyright © 2011-2022 走看看