PC Review


Reply
Thread Tools Rate Thread

Closing a page from code behind

 
 
=?Utf-8?B?THluZXR0ZQ==?=
Guest
Posts: n/a
 
      21st Jan 2004
On my page load sub in my code behind I want to run a script and close the window. I have the script running but I can not get the window to close.

Can someone tell me how to do this. I have try calling the page unload method but I must not know how to do this.

 
Reply With Quote
 
 
 
 
Nick Harris
Guest
Posts: n/a
 
      21st Jan 2004
is this windows forms or asp.net? I think your talking about asp.net, if
so, what I've done if it's a child page i write out javascript to close the
window using the httpcontext. You can't do this in code behind b/c it
executes on the server.

If i'm wrong and your talking about winforms just use win.close.

Hope this helps.

Nick Harris, MCSD


"Lynette" <(E-Mail Removed)> wrote in message
news:7A600AB2-5809-4768-800E-(E-Mail Removed)...
> On my page load sub in my code behind I want to run a script and close the

window. I have the script running but I can not get the window to close.
>
> Can someone tell me how to do this. I have try calling the page unload

method but I must not know how to do this.
>



 
Reply With Quote
 
Alvin Bruney
Guest
Posts: n/a
 
      22nd Jan 2004
the codebehind version would stream script out to the browser
one approach is Response.Write("<script>window.close()</script>");

unless the code runs under the HSA, you will get a confirmation dialog.


--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Nick Harris" <(E-Mail Removed)> wrote in message
news:er$(E-Mail Removed)...
> is this windows forms or asp.net? I think your talking about asp.net, if
> so, what I've done if it's a child page i write out javascript to close

the
> window using the httpcontext. You can't do this in code behind b/c it
> executes on the server.
>
> If i'm wrong and your talking about winforms just use win.close.
>
> Hope this helps.
>
> Nick Harris, MCSD
>
>
> "Lynette" <(E-Mail Removed)> wrote in message
> news:7A600AB2-5809-4768-800E-(E-Mail Removed)...
> > On my page load sub in my code behind I want to run a script and close

the
> window. I have the script running but I can not get the window to close.
> >
> > Can someone tell me how to do this. I have try calling the page unload

> method but I must not know how to do this.
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Master page code executed after child page code Luigi Microsoft ASP .NET 2 22nd May 2006 10:53 AM
Closing Code Brian Matlack Microsoft Excel Programming 0 13th Jan 2006 08:39 PM
how to open a page in a page so on closing you return to orig pag =?Utf-8?B?Sm9obg==?= Microsoft Frontpage 1 23rd Sep 2005 11:40 PM
Closing code Eric G Microsoft Access Form Coding 4 23rd Mar 2004 05:36 AM
VB Code for Closing DB Learning Microsoft Access Forms 1 30th Oct 2003 06:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:47 AM.