zoukankan      html  css  js  c++  java
  • CallClinetScript 选中行调用前台事件

    <script language="javascript" type="text/javascript">
    // <!CDATA[

    function btnSelect_onclick(id,name) {
       alert("用户ID:"+id+" 用户名:"+name) ;
       return false ;
    }
    // ]]>
    </script>

    //GridView控件的行数据绑定事件
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
       if (e.Row.RowType == DataControlRowType.DataRow) //如果是数据行
       {
          GridView grid = sender as GridView; //取当前操作的GridView
          //取出GridView当前行的键值
          string id = grid.DataKeys[e.Row.RowIndex].Value.ToString();
          //取出GridView当前行指定列的值
          string name = e.Row.Cells[2].Text;
          //设置GridView当前行按钮的客户端事件
          ((LinkButton)(e.Row.Cells[grid.Columns.Count - 1].Controls[0])).Attributes.Add("onclick", "return btnSelect_onclick('" + id + "','" + name + "')");
       }
    }

  • 相关阅读:
    containerd 与安全沙箱的 Kubernetes 初体验
    dubbo-go 中的 TPS Limit 设计与实现
    MVC
    DataGridView移动上下行
    Jquery hover 事件
    MVC
    MVC 基本概念
    AJAX简单封装
    ViewState
    PostBack
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/2867796.html
Copyright © 2011-2022 走看看