 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 29th, 2007, 10:39 AM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
close window with out message box
I have an visual studio web aspx application with a close window command button, named finish on my aspx application web page. I have code below that closes the page when clicked, but, I stoll receive the warning message. How can I get the aspx page to simply close "with out the message box requiring a yes or no" to close.
Here is my existing code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
FinishButton1.Attributes.Add("onclick", "window.opener = top; window.close();")
End Sub
Protected Sub FinishButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FinishButton1.Click
Response.Write("<script language='javascript'> { self.opener = top; self.close() }</script>")
End Sub
|
|

September 29th, 2007, 11:40 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
You can't close the parent window without IE spawning that message, it is a security feature that you can not override.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
|
|

September 29th, 2007, 01:12 PM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you,
I asked the question because, I saw a previous post about the same thing I am working on, http://p2p.wrox.com/topic.asp?TOPIC_ID=37337, and decided to give it a try.
|
|

September 29th, 2007, 01:23 PM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello,
I just want to close the current window that I am using. When I clik on a link on on my main menu, a new window page opens. I would like to close the new window without a message.
THank you in advance.
|
|

September 29th, 2007, 02:51 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
How do you open the new window? Normally if you use the javascript function: window.open() to open a new window, that window can be closed with window.close() without receiving the warning message.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
|
|

September 29th, 2007, 03:08 PM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I open the new window from an hyperlink (version 2.0.0.0 .net) using the NavigateUrl property set to the page and the Target property set to _blank.
Thank you in advance,
|
|

September 29th, 2007, 03:42 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Ok, just a general FYI, this is not related in anyway to the .NET framework, it is more how IE handles how windows are closed.
What you should try, instead of using a normal hyperlink, is to use the window.open() function to open your window and then try calling the close window function. This should work for you. (You could trigger the window.open event from a hyperlink however.)
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
|
|

September 29th, 2007, 05:17 PM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The command button with the window.open code attached works when I use the command directly on a form, but when I use it from within a InsertItemTemplate it does not work.
|
|

October 1st, 2007, 05:30 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Well you can try this, this should close the page without message
window.opener = null; window.close();
Regards
Mike
|
|
 |