Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an Ajax ModalPopUpExtender which works fine when launched by the target control, but what I want to do is launch it from a server side 'button_click' event.

This is because I want to check some variables before launching the ModalPopUpExtender.

I have tried the '.show' method which works fine on a 'PageLoad' event but the method won't work from an asp:button 'onclick' event.

I have given the ModalPopUpExtender a dummy button to target as you can't run one without the TargetControlID being set. The dummy control is visible.

As the '.show' method works on a 'PageLoad' event I know the ModalPopUpExtender is set up correctly, but what could be stopping it from running from a server-side event?

What I have tried:

<ajax:ModalPopupExtender
ID="mp1"
runat="server"
PopupControlID="Panel1"
TargetControlID="btnShowPopUp"																		CancelControlID="btnClose"
BackgroundCssClass="modalBackground">
</ajax:ModalPopupExtender>


Sub btnShow_Click(ByVal sender As Object, ByVal e As EventArgs)

       if myVariable = 1 then

          mp1.show

       End if

   End Sub
Posted
Updated 13-Dec-17 2:01am
Comments
Laxmidhar tatwa technologies 13-Dec-17 7:53am    
those some variables interested to hide take them in some control and hide the control in java scipt before calling the ajax extender

1 solution

The solution turned out to be to use an <asp:hiddenfield> as the target control instead of a button. This solved the problem immediately.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900