单个aspx页面上的两个modalpopup

时间:2013-03-23 05:29:26

标签: c# ajax

我在我的单个.aspx页面中使用了两个popup扩展器,这两个中没有一个弹出,但当我删除其中任何一个时,弹出正常。

<asp:Button ID="btnShowPopup" runat="server" style="display:none" /> 
<asp:Button ID="btnshowpopupisbn" runat="server" style="display:none" />  

<asp:ModalPopupExtender ID="ModalPopupExtender1"     runat="server"TargetControlID="btnShowPopup" PopupControlID="pnlpopup"
CancelControlID="btnCancel" BackgroundCssClass="modalBackground"     PopupDragHandleControlID="pnlpopup" >
    </asp:ModalPopupExtender>   
 <asp:Panel ID="pnlpopup" runat="server" CssClass="popup" >
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
 <ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

 <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server"       TargetControlID="btnshowpopupisbn" PopupControlID="pnlpopupisbn"   cancelControlID="btnCancel" BackgroundCssClass="modalBackground"    PopupDragHandleControlID="pnlpopup"></asp:ModalPopupExtender>
<asp:Panel ID="pnlpopupisbn" runat="server" CssClass="popup" Visible="False" >
<asp:UpdatePanel ID="UpdatePanel2" runat="server">


 <ContentTemplate>
 </ContentTemplate>
</asp:UpdatePanel> 
</asp:Panel>

3 个答案:

答案 0 :(得分:1)

不要将属性设置为false。将其设置为true

答案 1 :(得分:0)

您不需要在面板上提供Visible="False"属性,在使用ModalPopupExtender时会对其进行处理。 我刚尝试使用2个模态弹出窗口,工作正常。

<div>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <asp:Button ID="Button1" runat="server" Text="Popup 1" />
        <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" PopupControlID="Panel1"
            TargetControlID="Button1" OkControlID="Button2" BackgroundCssClass="ModalPopupBG">
        </asp:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" CssClass="popup">
            Some Content in Panel 1<br />
            <asp:Button ID="Button2" runat="server" Text="Close" />
        </asp:Panel>
        <asp:Button ID="Button3" runat="server" Text="Popup 2" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel2"
            TargetControlID="Button3" OkControlID="Button4" BackgroundCssClass="ModalPopupBG">
        </asp:ModalPopupExtender>
        <asp:Panel ID="Panel2" runat="server" CssClass="popup">
            Some Content in Panel 2<br />
            <asp:Button ID="Button4" runat="server" Text="Close" />
        </asp:Panel>
    </div>

<div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager> <asp:Button ID="Button1" runat="server" Text="Popup 1" /> <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" PopupControlID="Panel1" TargetControlID="Button1" OkControlID="Button2" BackgroundCssClass="ModalPopupBG"> </asp:ModalPopupExtender> <asp:Panel ID="Panel1" runat="server" CssClass="popup"> Some Content in Panel 1<br /> <asp:Button ID="Button2" runat="server" Text="Close" /> </asp:Panel> <asp:Button ID="Button3" runat="server" Text="Popup 2" /> <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel2" TargetControlID="Button3" OkControlID="Button4" BackgroundCssClass="ModalPopupBG"> </asp:ModalPopupExtender> <asp:Panel ID="Panel2" runat="server" CssClass="popup"> Some Content in Panel 2<br /> <asp:Button ID="Button4" runat="server" Text="Close" /> </asp:Panel> </div>

答案 2 :(得分:0)

你可以做Panel Visible =“False”