• 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());
                   。。。。。            }
            }

  • 相关阅读:
    iOS tableHeaderView有默认高度?
    flutter 自定义tabbar 给tabbar添加背景功能
    jar各个版本号的意义
    【转载】springboot + swagger
    分表需要解决的问题 & 基于MyBatis 的轻量分表落地方案
    解决Spring Boot中,通过filter打印post请求的 request body 问题
    SpringBoot自动配置xxxAutoConfiguration 的使用
    Shell
    Spring踩坑记录
    Spring中可复用工具类&&特性记录&&技巧
  • 原文地址:https://www.cnblogs.com/tongdengquan/p/6090595.html
Copyright © 2020-2023  润新知