开发者

Multiple ASP modal popups on one page

We have a working modal popup on an asp.net page, and need to add another one. A linkbutton opens the first one.

But if we try adding code for another linkbutton to open a second popup, which will use another mp extender control, neither one of them work. If we then remove the second popup and extender code, it works again.

I posted this question before but got an answer about using them in a gridview, which is not what is going on. This issue is not that complicated, just the fact that we can't get two separate popups working on a page. Are there any bugs or anything that would be preventing this from working?

The code below is for the working popup. It seems logical that if we add code that works to a page and give the controls new names, it should work as well, right? Anyway, a little help?

     <!--modal popup extender-->
<ajax:ModalPopupExtender ID="mpe1" runat="server"
        DropShadow="false" 
        TargetControlID="btn1"
        PopupControlID="mp1"
        BehaviorID="ModalPopBehavior" 
        CancelControlID="btnCancel">
</ajax:ModalPopupExtender>

<!--modal panel-->
<asp:Panel ID="mp1" runat="server" EnableViewState="true" Visible="False" Width="290px" height="140px"  
        BorderWidth="4px" BorderStyle="Ridge" BorderColor="Control" style="display:none;" >
 <asp:Table ID="Table1" runat="server" BorderStyle="None" Width="290px" Height="140px"  BackColor="#ffffee">
   <asp:TableRow ID="TableRow1" runat="server">                    
    <asp:TableCell ID="TableCell1" runat="server">
    <asp:Label ID="lbl1" runat="server" CssClass="PanelLabel" 
               Style="left: 60px; position: absolute; top: 4px"开发者_Python百科 Text="label1" 
               ForeColor="#0000C0" /> 
    <asp:Label ID="lbl2" runat="server" CssClass="StdLabel" 
               Style="left: 6px; position: absolute; top: 30px" Text="label2" />
    <asp:TextBox ID="txt1" runat="server" CssClass="StdTextbox"
                 Style="left: 6px; position: absolute; top: 44px" Width="120px" />  
    <asp:Label ID="lbl3" runat="server" CssClass="StdLabel" 
               Style="left: 160px; position: absolute; top: 30px" 
               Text="label3" />
    <asp:TextBox ID="txt2" runat="server" CssClass="StdTextbox"
                 Style="left: 160px; position: absolute; top: 44px" Width="120px" />
    <asp:Button ID="btnOK" runat="server"  
                    Style="font-family: Tahoma; font-size: 11px; color: Navy; left: 60px; 
                    position: absolute; top: 86px" Text="OK" Width="90px" />
    <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="50px"
                style="font-family: Tahoma; font-size: 11px; color: Navy; top: 86px; left: 170px; 
                position:absolute;"/>
   </asp:TableCell>
  </asp:TableRow>
 </asp:Table></asp:Panel>

In the page there is also the hidden button for the popup. it looks like this:

   <!--hidden button for modal popup -->
   <asp:Button ID="btn1" visible="true" runat="server" Style="display: none" Enabled="false" />


ok so the problem was that the behaviorID property for each extender had to be unique. Once I set the behaviorID to the same name as the ID in each extender, they all work. Of course all other controls on all popup objects themselves must also be unique.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜