zoukankan      html  css  js  c++  java
  • GridView Edit 和Delete

    前台:                                   

    <asp:CommandField ButtonType="Image"  HeaderText="Edit"   EditImageUrl="~/client_support/images/edit.GIF"  UpdateImageUrl ="~/client_support/images/save.gif" CancelImageUrl="~/client_support/images/cancel.gif"  ShowEditButton ="True"   >
                                        </asp:CommandField>
                                        <asp:TemplateField HeaderText="Delete">
                                            <ItemTemplate>
                                                  <asp:ImageButton ID = "ibnDelete" runat="server"   ImageUrl ="~/client_support/images/del.gif"  CommandName="Delete"
                                                    OnClientClick ="return confirm('Are you sure to delete?');"/>
                                            </ItemTemplate>
                                        </asp:TemplateField>

    后台:

        protected void gdvTax_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                this.gdvTax.EditIndex = e.NewEditIndex;
                BindGridView();
            }
            catch (Exception ex)
            {
                AlertExceptionMessage(ex, MethodBase.GetCurrentMethod());
            }

        }

    protected void gdvTax_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {   
                //Update

                AlertMessage("Update success!");
                this.gdvTax.EditIndex = -1;
                BindGridView();
            }
            catch (Exception ex)
            {
                AlertExceptionMessage(ex, MethodBase.GetCurrentMethod());
            }
        }

        protected void gdvTax_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            try
            {
                this.gdvTax.EditIndex = -1;
                BindGridView();
            }
            catch (Exception ex)
            {
                AlertExceptionMessage(ex, MethodBase.GetCurrentMethod());
            }
        }

        protected void gdvTax_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                     //Delete           
                    AlertMessage("Delete success!");
                    BindGridView();
                
            }
            catch (Exception ex)
            {
                AlertExceptionMessage(ex, MethodBase.GetCurrentMethod());
            }
        }

  • 相关阅读:
    Linux下c程序的编译方法:
    Linux分区机制和常见命令
    java虚拟机内存大小调整:
    break、continue、return循环三剑客之异同
    Scanner中的nextInt()陷阱
    windbg无法下载符号文件
    各种函数调用约定及浮点数传参
    一个crackme的分析
    SetProcessAffinityMask的问题
    x64内联汇编注意点
  • 原文地址:https://www.cnblogs.com/andycai/p/1750717.html
Copyright © 2011-2022 走看看