开发者

ModalPopup Not Showing (ASP.NET/VB)

开发者 https://www.devze.com 2023-03-18 03:04 出处:网络
I can\'t figure this out. I\'ve tried everything and am pulling my hair out. I can\'t seem to call this:

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">&nbsp;
            </div>
            <div class="Controls">
                <center><table border=0 cellpadding=0 cellspacing=0><tr><td><img src="Images/ajax-loader.gif" /></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号