We help IT Professionals succeed at work.

Expose ModalPopupExtender show and Hide properties in a User Control

Steve Krile
Steve Krile asked
Medium Priority
Last Modified: 2013-11-07
I have a user control that contains a modalpopupextender.  How can I make the Show and Hide methods of the extender available to the page where I put the user control?
Example use in a page:
<uc1:CaseModal runat="server" id="cm1" />
Then, in my code page I want to do something like:
Public Sub....
   cm1.Show()   <---this would trigger the Show method of the Extender IN the user control.
End Sub
Here is a simple user control:
<asp:Panel id="modalPnl" runat="server" style="display:none;" CssClass="modalPopup">
   <asp:LinkButton id="closeCaseModal" runat="server" text="Close" />
            BackgroundCssClass="modalBackground" />
        <asp:LinkButton ID="fakebutton" runat="server" style="display:none;" />

Open in new window

Watch Question


And just for clarity, if my "parent" page for the user control was "test.aspx", then I would want the cm1.show() code in "test.aspx.vb"
In the code behind file for you user control, add the following

Public Sub Show()
End Sub

Public Sub Hide()
End Sub

This should add public methods to your user control which you can use from "test.aspx"

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


<hand slaps forehead />  

Thanks.  That's what I wanted exactly.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.