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 in VB.
This is because I want to check some variables before launching the ModalPopUpExtender.
I have tried the .show method which works fine on an initial PageLoad event when there is no post back, but the method won't work from an asp:button's onclick event or from a post back 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?
Here's my code:
<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