?
Solved

Command button to unload page

Posted on 2009-04-07
4
Medium Priority
?
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

771 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