Modal popup expander that does not display a panel when a button is pressed

I am trying to use a modal popup extender on my page, so when I click the button, it should show the panel. Here is what I have:

    <asp:UpdatePanel runat="server" ID="updPanel">
    <ContentTemplate>
        <ajaxToolkit:ModalPopupExtender ID="mpeEmailComplete" runat="server" TargetControlID="btnTesting"
            PopupControlID="pnl" OkControlID="btnOk"
             BackgroundCssClass="modalBackground">
        </ajaxToolkit:ModalPopupExtender>



        <asp:Panel ID="pnl" runat="server" style="display:none;">
            <asp:UpdatePanel ID="udp" runat="server">
                <ContentTemplate>
                    <asp:Panel runat="server" ID="pnlEmailComplete" Visible="false">
                        <asp:Label runat="server" ID="lblTest" Text="Testing testing testing"></asp:Label>
                        <asp:Button runat="server" ID="btnOk" Text="OK" />
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>


        <asp:Button runat="server" ID="btnTesting" Text="Testing"/>

    </ContentTemplate>
</asp:UpdatePanel>

but I cannot make the panel pop up when I click a button. Does anyone know why?

+3
source share
3 answers

In your inner panel, Visible = false.

<asp:Panel runat="server" ID="pnlEmailComplete" Visible="false">  *(change here)*

So, when you press the TESTING button, ModalPopupExtender correctly displays the external panel, but it displays an invisible internal panel, so you can’t see anything on the screen.

<asp:Panel ID="pnl" runat="server" style="display:none;">  *(this is ok)*

To fix, just pull Visible = false from the external panel (pnlEmailComplete)   

Hope this helps!

+1

JavaScript pnl.Visible=False; -?

, AjaxControlToolkit , NuGet - .

http://nuget.org/packages/ajaxcontroltoolkit

0
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Button ID="Btnshow" runat="server" Text="Show" OnClick="Btnshow_Click" />
        <asp:Button ID="BtnTarget" runat="server" Text="Target" Style="display: none" />
        <asp:TextBox ID="TextBox1" runat="server">
        </asp:TextBox>
        <input type="button" value="Get" onclick="abc()" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="BtnTarget"
            PopupControlID="Panel1">
        </asp:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" BackColor="Black" Width="300px" Height="300px">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Button ID="BtnHide" runat="server" Text="Hide Button" OnClick="BtnHide_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="BtnHide" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
        </asp:Panel>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Btnshow" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
0
source

All Articles