两个模式弹出窗口一起无法在asp.net中工作

时间:2019-03-13 16:18:20

标签: javascript c# asp.net

不幸的是,我试图让两个不同的模式弹出窗口同时工作,当我调用第二个模式弹出窗口时,它仍然打开了第一个模式弹出窗口,我不明白为什么会这样。

这是我的JavaScript

function ShowModalPopup() {
    $find("mpe").show();
    return false;
}
function HideModalPopup() {
    $find("mpe").hide();
    return false;
    var listItems = document.getElementsByTagName("li")

    for (var i = 0; i < listItems.length; i++) {
        listItems[i].addEventListener("click", function (event) {
            console.log("list item clicked");
        });
    }
}


function ShowModalPopup2() {
    $find("mpe2").show();
    return false;
}
function HideModalPopup2() {
    $find("mpe2").hide();
    return false;
    var listItems = document.getElementsByTagName("li")

    for (var i = 0; i < listItems.length; i++) {
        listItems[i].addEventListener("click", function (event) {
            console.log("list item clicked");
        });
    }
}

这是我的前端

<asp:Button class="btn btn-primary" ID="btnShow" runat="server" Text="Cambiar la cantidad" OnClientClick="return ShowModalPopup()" visible="false"/>


 <asp:Button class="btn btn-primary" ID="btnPurchaseOrder" runat="server" Text="Comprar" OnClientClick="return ShowModalPopup2()" AutoPostback="false" OnClick="CreateAPurchaseOrder_Click" />

     <%--  MY DIALOG BOX IS HERE--%>
                        <asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
                        <cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="mpe" runat="server"
                            PopupControlID="pnlPopup" TargetControlID="lnkDummy" BackgroundCssClass="modalBackground">
                        </cc1:ModalPopupExtender>
                        <asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
                            <div class="header">
                                Cambiar la cantidad
                            </div>
                            <div class="body">
                                <asp:Label ID="lblType" runat="server" Text=""></asp:Label>
                                <br/>
                                <label for="validationOfTypeID">Armario:</label>
                                  <asp:DropDownList ID = "drCloset" runat="server" Width="40%" Height="30px" AutoPostBack="True" OnSelectedIndexChanged = "OnClosetIndexChanged">
                                 </asp:DropDownList>
                                <br/>
                                <label for="validationOfTypeID">cajón:</label>
                                  <asp:DropDownList ID = "drDrawer" runat="server" Width="40%" Height="30px" >
                                 </asp:DropDownList>
                                <br />
                               <asp:Label ID="lblQuantity" runat="server" Text=""></asp:Label>
                                   <asp:DropDownList Height="30px" ID="drOperation" runat="server">
                                       <asp:ListItem>+</asp:ListItem>
                                       <asp:ListItem>-</asp:ListItem>
                                </asp:DropDownList> 
                                <asp:TextBox width="50px" ID="txtChangeQuantity" runat="server" TextMode="Number" min="0" step="1" Value="0"></asp:TextBox>
                                                                  <br/>
                                <asp:Button ID="btnChangeQuantity" runat="server" Text="Validar" OnClick="change_quantity_Click" /> 
                                <asp:Button ID="btnHide" runat="server" Text="Anular" OnClientClick="return HideModalPopup()" />
                            </div>
                        </asp:Panel>
            <%--  MY DIALOG BOX IS HERE--%>



            <%--  MY DIALOG BOX IS HERE--%>
                        <asp:LinkButton ID="LinkButton1" runat="server"></asp:LinkButton>
                        <cc1:ModalPopupExtender ID="ModalPopupExtender2" BehaviorID="mpe2" runat="server"
                            PopupControlID="pnlPopup" TargetControlID="lnkDummy" BackgroundCssClass="modalBackground">
                        </cc1:ModalPopupExtender>
                        <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none">
                            <div class="header">
                                Cambiar la cantidad
                            </div>
                            <div class="body">
                                <asp:Button ID="btnAdd" runat="server" Text="Validar" OnClick="change_quantity_Click" /> 
                                <asp:Button ID="btnHide2" runat="server" Text="Anular" OnClientClick="return HideModalPopup2()" />
                            </div>
                        </asp:Panel>
            <%--  MY DIALOG BOX IS HERE--%>
                      </div>

这是我的后端

 protected void CreateAPurchaseOrder_Click(object sender, EventArgs e)
        {
            ModalPopupExtender2.Show();
        }
        protected void OnClosetIndexChanged(object sender, EventArgs e)
        {
            ModalPopupExtender1.Show(); //Prevents dialog from closing during autopostback
        }

为什么当我按下按钮“ comprar”时,ModalPopup1显示而不是ModalPopup2。任何帮助将不胜感激。

0 个答案:

没有答案