How can I hide a ModalPopupExtender embedded in an ASCX user control through javascript (with no postback)?

Hi:

I have an Asp.net application.
Within that application I have a ModalPopupExtender embedded within an ASCX user control.
I would like to be able to wire up a cancel button so I can hide the popup when user presses cancel
without doing a post back.

Here is what I have so far:
<cc1:ModalPopupExtender ID="PopupExtender1" runat="server" PopupControlID="pnlPopup" BehaviorID="mdlPopupForm"
    TargetControlID="btnHiddenSubmit" OkControlID="btnOkay" CancelControlID="btnCancel" 
    Drag="true" PopupDragHandleControlID="PopupHeader" EnableViewState="true" 
    BackgroundCssClass="modalBackground" ClientIDMode="Static" />

Open in new window

Here is the HTML for btnCancel:
<input type="button" id="btnCancel" onclick="cancelPopupPanelClick()" value="Cancel" />

Open in new window

Here is the javascript:
    function cancelPopupPanelClick() {

        alert('CancelEventFired');
        var modalPopup = $find('PopupExtender1');
        if (modalPopup != null) {
            modalPopup.hide();
        }
    }

Open in new window

The event fires fine. The issue I'm having is that I can't "Find" the modalPopup in order to hide it.
Is this complicated by the fact that I have the ModalPopupExtender embedded in an ASCX control?

I have verified that the "AjaxControlToolkit.ToolkitScriptManager" is loaded in the containing ASPX page.

Can someone get me pointed in the right direction?

Thanks,
JohnB
LVL 1
jxbmaSoftware ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dejaanbuCommented:
use Behaviour ID of your modalpopup...

change this  
var modalPopup = $find('PopupExtender1');

Open in new window

TO
var modalPopup = $find('mdlPopupForm');

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.