按钮点击更新面板内部导致帖子返回

本文关键字:返回 内部 更新 按钮 | 更新日期: 2023-09-27 18:19:44

我想在单击更新面板内的按钮时返回页面。我附上我的密码。我想让帖子返回的按钮是btUnUpdate。我的目标是当操作在模式弹出窗口内完成时,将更新模式弹出窗口外的网格视图。主要的问题是,我在同一个模式弹出窗口中有多个内容占位符,我想异步运行。

 <asp:Panel ID="Panel1" runat="server"></asp:Panel>
    <asp:Button  ID="btnShowPopup" runat="server" style="display:none" /> 
              <asp:ModalPopupExtender ID="ModalPopupExtender1" PopupDragHandleControlID="Panel1" RepositionMode="None" runat="server" PopupControlID="pnlpopup" 
TargetControlID="btnShowPopup" CancelControlID="btnCancel"
    DropShadow="true"   
 BackgroundCssClass="modalBackground">
        </asp:ModalPopupExtender>
        <asp:Panel ID="pnlpopup" runat="server" BackColor="LightGray" style="display: none"
             CssClass="modalPopup" Width="650px" >
               <asp:UpdatePanel ID="UpdatePanel3" UpdateMode="Conditional" runat="server">
                                <ContentTemplate>
             <asp:PlaceHolder ID="PlaceHolder1" Visible="false" runat="server">
 <asp:Button ID="btnUpdate" ValidationGroup="r" runat="server" Height="30px" Width="160px" CommandName="Update" 
                                          OnClick="btnUpdate_Click" Text="Save"  
                                          Visible="False" />
                                      <asp:Button ID="Button5" runat="server" ValidationGroup="r" Height="30px" Width="160px" onclick="Button5_Click" Text="Save" 
                                          Visible="False" />
</asp:PlaceHolder>
                          <asp:PlaceHolder ID="PlaceHolder2" Visible="false" runat="server">
                     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                     <ContentTemplate>
<asp:Button ID="btn1" ValidationGroup="a" runat="server" Height="30px" Width="160px" CommandName="Update" 
                                          OnClick="btn1_Click" Text="Save"  
                                          Visible="False" />
                     </ContentTemplate>
                     </asp:UpdatePanel>
                        </asp:PlaceHolder>

按钮点击更新面板内部导致帖子返回

使用

              <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                        <%--Content that you want to update on Button1 or Button2--%>//write content that you want to update
                        </ContentTemplate>
                        <Triggers>
//trigger asyn event of control and it's event 
                        <%--asp:AsyncPostBackTrigger  events of control on which this content should update--%>
                            <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>

了解更多信息http://msdn.microsoft.com/en-us/library/bb399001%28v=vs.100%29.aspx