I want开发者_如何学Go to calling a javascript function from a asp.net modal window using vb. The javascript function is to close the same modal window.
The function I want call is: function CloseModalWindow(winName)
I tried
Page.ClientScript.RegisterStartupScript
but that does not work. How can I do that from vb.net code behind?
If you are looking to close a modal window, perhaps place a label on the aspx side, and then use a label with similar to:
<a href="javascript:CloseModalWindow('ThisWindow')"><asp:Label runat="server" Text="Close Me"></Label></a>
HTH
You're actually on the exact right track.
You should find that you are able to call the described method by using something like this...
ClientScript.RegisterStartupScript(Me.GetType, Guid.NewGuid().ToString(), "window.parent.CloseModalWindow('WindowName');", True)
Maybe try using a web browser control and launching the page and function from that? Make the control not visible aswell.
精彩评论