Expose ModalPopupExtender show and Hide properties in a User Control

Posted on 2009-02-13
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

Question by:skrile
    LVL 16

    Author Comment

    And just for clarity, if my "parent" page for the user control was "test.aspx", then I would want the code in "test.aspx.vb"
    LVL 11

    Accepted Solution

    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"
    LVL 16

    Author Comment

    <hand slaps forehead />  

    Thanks.  That's what I wanted exactly.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now