Link to home
Start Free TrialLog in
Avatar of John Account
John Account

asked on

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.
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

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?
Avatar of John Account
John Account

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks