AJAX modal popup

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?
Who is Participating?
CodeCruiserConnect With a Mentor Commented:
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

Show us the code.

You need to return true from your javascript call for the button to post back to code behind.
HLRosenbergerAuthor Commented:
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">
HLRosenbergerConnect With a Mentor Author Commented:
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:


HLRosenbergerAuthor Commented:
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.

All Courses

From novice to tech pro — start learning today.