zoukankan      html  css  js  c++  java
  • gridview行按钮事件

    前台

     <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                        <asp:Panel ID="panel_delete" runat="server">
                             <img src="../../images/admin/detelIcon.gif" />
                            <asp:LinkButton ID="LinkButton_Delete" runat="server" CausesValidation="False" CommandName="Delete" Text="删除" OnClientClick='<%#Eval("ranking_class_chinese_name","return confirm(/"确定删除:{0} ?/")")%>'></asp:LinkButton>&nbsp;&nbsp;
                             <img src="../../images/admin/editIcon.gif" />
                            <asp:LinkButton ID="LinkButton_select" runat="server" CausesValidation="False" CommandName="Select" Text="编辑"></asp:LinkButton>
                        </asp:Panel>
                       
                        <asp:Panel ID="panel_update" runat="server" Visible="false">
                             <img src="../../images/admin/detelIcon.gif" />
                             <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="UpdateScore" Text="更新" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'></asp:LinkButton>&nbsp;&nbsp;
                             <img src="../../images/admin/editIcon.gif" />
                            <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CommandName="CancelingEdit" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' Text="取消"></asp:LinkButton>
                        </asp:Panel>
                           
                        </ItemTemplate>
                    </asp:TemplateField>

    后台

     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
            {
              
                if (e.CommandName == "CancelingEdit")
                {
                    int index = int.Parse(e.CommandArgument.ToString());
                  。。。。            }

                if (e.CommandName == "UpdateScore")
                {
                    int index = int.Parse(e.CommandArgument.ToString());
                   。。。。。            }
            }

  • 相关阅读:
    第十一节 jQuery特殊效果
    第十节 使用index和一个点击事件实现选项卡
    synchronized和lock两种锁的比较
    常见的四种线程池和区别
    mybatis中的#和$的区别
    web 防止SQL注入
    GIT配置免密登录
    热点 Key 问题的发现与解决
    Redis缓存击穿
    面试必问之JVM原理
  • 原文地址:https://www.cnblogs.com/tongdengquan/p/6090595.html
Copyright © 2011-2022 走看看