Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 December 16th, 2003, 12:17 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default client script in code behind .cs file

I have an aspx page with a form that gets submitted. I need to open a window when the form gets submitted (with something like "Stand By while we process your request...") -- this is done. What I can't figure out, however, is how I can close this window after all my server code has been run. With ASP, it was easy, because I just put the client script in between %> <%. With code behind, I'm stumped. Any ideas how I can accomplish this? Thanks in advance.
__________________
Steve
iTek Corporation
http://itekcorp.com
 
Old December 16th, 2003, 12:35 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can still use Response.Write() in .net. Response.buffering is turned on by default with ASP.net so you'll need to make sure that it's turned off before you can get chunks of script to the browser without finishing processing the whole page.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 16th, 2003, 03:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You could also use a literal to do this. Place the literal at the end of your page. In your code behind in the Page_Load, something like:

'Process all of your code

ltrlName.Text = "<SCRIPT LANGUAGE=""JavaScript"">" _
& "<!-- " _
& "window.close();" _
& "//--></SCRIPT>"
 
Old December 16th, 2003, 03:21 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the great information! My challenge is that I need to open/close a separate window, like so:

1) Page A opens Page B <-- this is done, no problem
2) Page A runs some server code <-- this is done
3) Page A closes Page B <-- this is what I can't figure out

Thanks again.
 
Old December 16th, 2003, 04:03 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Aha... this is easy.

On Page A, when you open the window, save a reference to it...

var m_winPageB = window.open(...);

Then when the Page A server code is done, you write out more script:

m_winPageB.close();

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Client side script in code-behind asp.net sajid_pk ASP.NET 2.0 Basics 1 February 11th, 2005 04:22 AM
Writing Client Side Script from Code-Behind code sajid_pk Classic ASP Databases 1 January 18th, 2005 12:53 AM
Writing client side script in code-behind asp.net sajid_pk ADO.NET 1 January 13th, 2005 08:12 AM
writing client-side script in code-behind asp .net sajid_pk General .NET 1 January 13th, 2005 08:11 AM





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