Solved

Command button to unload page

Posted on 2009-04-07
4
541 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now