AJAX Popup Control Extender not working

918 Views Asked by At

I am new to asp.net. I have been fighting for a while now and can't get a simple popup to work. All I want to do is have a button display a small window with some text in it for the user to read.

<div id="leftColumn">
        <asp:Button ID="Button1" runat="server" Text="Click For Window"  />

        <asp:Panel ID="Panel1" runat="server" CssClass="popupControl">

            <p>TEST Stuff. Lorem Ipsum textum fillum spaceum.</p>

        </asp:Panel>

    <asp:PopupControlExtender ID="PopupControlExtender1" runat="server" 
      TargetControlID="Button1" 
      PopupControlID="Panel1"  >
    </asp:PopupControlExtender>
 </div>

The css file contains "visibility:hidden;" for Panel1. I run the page, and click the button and get nothing. I also tried in-line with visible="false" with a codebehind that on click, changes to Visible=true.

Thanks for any reply.

1

There are 1 best solutions below

1
Aniket On

Try this one :

    <asp:HiddenField ID="HiddenField1" runat="server" />
            <asp:ModalPopupExtender ID="MyPopup" runat="server" PopupControlID="Panel1" DynamicServicePath="" Enabled="True" TargetControlID="HiddenField1">

    <asp:Button ID="Button1" runat="server" Text="Click For Window" OnClick="Button1_Click" />
     <div>
      <asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
        <p>TEST Stuff. Lorem Ipsum textum fillum spaceum.</p>

     </asp:Panel>

and on Button1_Click event add

  MyPopup.Show();