1

我想在单击更新面板内的按钮时返回页面。我附上我的代码。我想要回发的按钮是 btnUpdate。我的目标是当模态弹出框内的操作完成时,要更新模态弹出框外的gridview。主要问题是我在同一个模式弹出窗口中有多个内容占位符,我想异步运行。

 <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>
4

1 回答 1

0

利用

              <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

于 2013-06-25T09:13:23.797 回答