Multiple ASP popups on one page

We have a working modal popup on an asp.net page, and you need to add another one. The link button opens the first.

But if we try to add code for another linkbutton to open a second pop-up window in which another mp expansion controller will be used, none of them work. If we remove the second popup and extender code, it will work again.

I posted this question earlier, but got an answer about using them in a gridview, which is not what happens. This problem is not so complicated, just the fact that we cannot get two separate pop-ups working on the page. Are there any bugs or something that keeps this from working?

Below is the code for the working popup. It seems logical if we add code that works on the page and give new management names, it should work too, right? Anyway, help a little?

     <!--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" 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>

The page has a hidden button for a pop-up window. it looks like this:

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

ok, so the problem was that the behaviorID property for each expander had to be unique. As soon as I set the behavior identifier with the same name as the identifier in each expander, they all work. Of course, all other controls for all pop-up objects themselves must also be unique.

+3
source

Source: https://habr.com/ru/post/1781060/


All Articles