Wrox Programmer Forums
|
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
 
Old September 29th, 2004, 01:35 AM
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controling Window.Close( )

Hi,

I have used the following in the code behind.

If (............)
  Response.Write("<script>Window.Close()</script>")
End If

This above code gives a user confirmation box (Yes / No)
I want to check what the user has clicked and act accordingly.

Please Help regarding this.
should i remove this code and add it in javascript function.



Regards
Vijay R
 
Old September 29th, 2004, 01:45 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

are you using a javascript confirm to get a confirmation from the user?. If yes you can use either full javascript or a combination of both

Regards
Ganesh
 
Old September 29th, 2004, 02:50 AM
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ganesh,

No i am not using them ath the moment, i would want to use them,
that is what i am asking about ,
how to use them ?
and all other mehtods that can also perform the same functionality

:-)

Thanks


Regards
Vijay R
 
Old September 29th, 2004, 02:57 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

In your close button, you can add a client side function from the page load event
    Button1.Attributes.Add("onclick", "return confirm('Are you sure you want to quit?')")

now you can write code in the click event in the server side
     Response.Write("<script>Window.Close()</script>")

no need to check for anything.

Regards
Ganesh
 
Old September 29th, 2004, 04:01 AM
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default



Regards
Vijay R
 
Old September 29th, 2004, 05:25 AM
Registered User
 
Join Date: Aug 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ganesh,

I will try what you said,
Is there any other solution for this



Regards
Vijay R
 
Old September 29th, 2004, 05:40 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

you can try this also...

insted of Response.Write, you copy and paste the following code after your "</form>" tag

<script language="javascript">
     <asp:literal runat="server" id="ltScript"></asp:literal>
</script>



in your appropriate event (cmdClose_Click ???), you copy and paste the following code.

Literal ltScript = (Literal) Page.FindControl("ltScript");
ltScript.Text = "Window.Close();"

Regards
Ganesh
 
Old September 29th, 2004, 05:55 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

you can try this
     Response.Write("<script>top.opener = top; top.window.close()</script>")

But it can only work in IE only


(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is how you got it





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a popup window janakiraman Javascript 0 June 25th, 2007 01:08 AM
Window.close muthuprakash83 Javascript How-To 0 August 7th, 2006 12:35 PM
window.close() failing to...well...close! mheathcote Javascript How-To 2 October 31st, 2005 03:02 PM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM
How do i close pop-up window?: window.close () Burton HTML Code Clinic 2 September 8th, 2003 05:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.