ModalPopup Not Showing (ASP.NET/VB)
I can't figure this out. I've tried everything and am pulling my hair out. I can't seem to call this:
<asp:Button ID="Button3" runat="server" Text="Button" style="display: none;" />
<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
targetcontrolid="Button3" popupcontrolid="Panel1"
popupdraghandlecontrolid="Popup2" drag="true"
backgroundcssclass="ModalPopupBG">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server">
<div class="HellowWorldPopup">
&l开发者_JAVA百科t;div class="PopupHeader2" id="Popup2">
</div>
<div class="Controls">
<center><table border=0 cellpadding=0 cellspacing=0><tr><td><img src="Images/ajax-loader.gif" /></td><td> Please Wait...</td></tr></table></center>
</div>
</div>
</asp:Panel>
By using this:
Protected Sub LoginButton_Click1(ByVal sender As Object, ByVal e As EventArgs)
Me.ModalPopupExtender2.Show()
System.Threading.Thread.Sleep(1000)
Me.ModalPopupExtender2.Hide()
End Sub
What, on Earth, is wrong with my code? The button executes, and when I step through I get a 'There is no source code available for the current location' when it hits Me.ModalPopupExtender2.Show().
Any ideas?
Thanks,
Jason
You need to allow the Response to the LoginButton_Click1 to complete before you put the thread to sleep and hide the popup. In other words, take out
System.Threading.Thread.Sleep(1000)
Me.ModalPopupExtender2.Hide()
You'll need to use some other mechanism to hide the popup after your timeout. One common way is to set a javascript timeout on the client and have it close the window.
The javascript timeout function would have code like this in it (make sure it's after the scriptmanager on the page).
var mpu = $find('ModalPopupExtender2');
mpu.hide();
精彩评论