none
GridView中点击取消超链接,如何还原到编辑删除页面,而不是停留在原来的页面 RRS feed

  • 问题

  • 前台的代码为:
    <asp:TemplateField HeaderText="操作" ShowHeader="False">
                                    <EditItemTemplate>
                                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Update">更新</asp:LinkButton>
                                       <asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False"
                                            CommandName="cancle">取消</asp:LinkButton>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Edit"
                                            onclientclick="return window.confirm('确认编辑吗?')">编辑</asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return window.confirm('确定删除吗?')" CommandName="Delete" Text="删除"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
    后台的代码为:
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            GridView1.EditIndex = -1;                   //GridView编辑项的索引等于单击行的索引
            GridViewBind();
        }

    还用,在编辑的过程中,我感觉用不用这个事件都是无所谓的,没多大影响
    2010年2月1日 7:55

答案

全部回复