• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 476
  • Last Modified:

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?
0
HLRosenberger
Asked:
HLRosenberger
  • 3
  • 2
2 Solutions
 
CodeCruiserCommented:
Show us the code.

You need to return true from your javascript call for the button to post back to code behind.
0
 
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">
0
 
CodeCruiserCommented:
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

http://forums.asp.net/p/1016160/1366212.aspx
0
 
HLRosenbergerAuthor 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:

modalPopup.Show();

0
 
HLRosenbergerAuthor Commented:
Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now