AJAX modal popup

Posted on 2011-10-20
Last Modified: 2012-05-12
I'm using the AJAX modal popup.  When the button that is tied to the popup is clicked, I need to add some code in the code-behind prior to the modal panel showing.    However, the normal click event does not seem to fire.  When I disconnect the button from the  AJAX modal popup, then I get the click event.

Does this sound correct?  If there a way around it?
Question by:HLRosenberger
    LVL 83

    Expert Comment

    Show us the code.

    You need to return true from your javascript call for the button to post back to code behind.
    LVL 1

    Author Comment

    This?   Javascript?  I have no Javascript associated with this, as far as I know.    

    <asp:modalpopupextender runat="server" id="ModalPopup" targetcontrolid="btnPrintWithParms" backgroundcssclass="modalBackground" popupcontrolid="ModalPopUpPanel"></asp:modalpopupextender>

    <asp:button id="btnPrintWithParms" runat="server" text="Button" cssclass="button_link">
    LVL 83

    Accepted Solution

    The normal click event would not fire. You can either call the code behind from the client side using may be jquery or you leave the button as normal(remove its link from popup) and call the popup from code behind

    Showing modal popup from code behind
    LVL 1

    Assisted Solution

    Yes, I have been reading that the click event does not fire.  Seems like a bug.  I found this simple solution that works:

    Try this.

    Create a dummy hidden field:

    <asp:HiddenField ID="hdnField" runat="server" />

    Set the TargetcontrolID = "hdnField" in your Modal Popup declaration.

    In your btnSaveData_Click event, do this:


    LVL 1

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    761 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

    8 Experts available now in Live!

    Get 1:1 Help Now