Solved

Command button to unload page

Posted on 2009-04-07
4
545 Views
Last Modified: 2013-12-17
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.
0
Comment
Question by:John Account
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 24092064
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
 

Author Comment

by:John Account
ID: 24092179
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
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 24092332
Yes, as i said in my last post, to close the current window with javascript you use:

    self.close();

Or:

   window.close();
0
 

Author Closing Comment

by:John Account
ID: 31567756
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question