Command button to unload page

I want a command button on my asp.net vb page to call a javascript function before closing the page. I have a command button now that I was experiementing with, and in code behind this code: InjectScript.Text = "<script>OpenWindowDiag()</" + "script>" But I don't know how to make it close the window. Any help? Thanks.
John AccountAsked:
Who is Participating?
 
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
Yes, as i said in my last post, to close the current window with javascript you use:

    self.close();

Or:

   window.close();
0
 
Carl TawnSystems and Integration DeveloperCommented:
Well, the javascript would simply be: self.close(); or window.close();

Are you trying to do this with a client-side click handler or by injecting the script from your code-behind?
0
 
John AccountAuthor Commented:
Well, maybe I should use my command button somethign like this? -- <asp:Button ID="Button1" runat="server" Text="Open window" OnClientClick="OpenWindow('RadWindow1');return false;" />

But do you know a javascript to close the window?
0
 
John AccountAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.