473,503 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open new browser window from server

I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing
page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen.
Anyone found the solution??

MTIA
wardeaux
Nov 18 '05 #1
6 4068
You won't be able to do that from the server. You'll have to do this on the client-side with javascript. Write it out to the page somewhere on the response.

"Wardeaux" <wa******@bellsouth.net> wrote in message news:ed**************@TK2MSFTNGP10.phx.gbl...
I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing
page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen.
Anyone found the solution??

MTIA
wardeaux

Nov 18 '05 #2
Wardeaux wrote:
I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing
page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen.
Anyone found the solution??

MTIA
wardeaux


You have to insert some Javascript to popup the new window when loaded,
since the server has no concept of a 'client window'.

Here's an example of how to inject the script, replace the alert with
whatever you're trying to do.

http://searchvb.techtarget.com/vsnet...293672,00.html

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #3
Use RegisterStartupScript method in your codebehind to register a client side window.open javascript call.

It will be rendered as the page reloads and when the browser encounters the javascript code it will execute it.

http://msdn.microsoft.com/library/de...BlockTopic.asp

HTH,
Suresh.

"Wardeaux" wrote:
I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing
page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen.
Anyone found the solution??

MTIA
wardeaux

Nov 18 '05 #4
Craig,
thanks! :)
wardeaux
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:e3**************@TK2MSFTNGP10.phx.gbl...
Wardeaux wrote:
I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen. Anyone found the solution??

MTIA
wardeaux
You have to insert some Javascript to popup the new window when loaded,
since the server has no concept of a 'client window'.

Here's an example of how to inject the script, replace the alert with
whatever you're trying to do.

http://searchvb.techtarget.com/vsnet...293672,00.html
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #5
Suresh,
thanks! Any way to keep that script from running EVERY time the page is
loaded like when you hit either the "Back" or "Refresh" button?
wardeaux

"Suresh" <Su****@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
Use RegisterStartupScript method in your codebehind to register a client side window.open javascript call.
It will be rendered as the page reloads and when the browser encounters the javascript code it will execute it.
http://msdn.microsoft.com/library/de...BlockTopic.asp
HTH,
Suresh.

"Wardeaux" wrote:
I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen. Anyone found the solution??

MTIA
wardeaux

Nov 18 '05 #6
Refresh will cause a page load. Since the window.open is registered on postback the script shouldn't be registered on page load.

As for when the user presses the browser back button?
That's a drawback of using RegisterStartupScript method.

Suresh.

"Wardeaux" wrote:
Suresh,
thanks! Any way to keep that script from running EVERY time the page is
loaded like when you hit either the "Back" or "Refresh" button?
wardeaux

"Suresh" <Su****@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
Use RegisterStartupScript method in your codebehind to register a client

side window.open javascript call.

It will be rendered as the page reloads and when the browser encounters

the javascript code it will execute it.

http://msdn.microsoft.com/library/de...BlockTopic.asp

HTH,
Suresh.

"Wardeaux" wrote:
I can't find a way to open a new browser window from my codebehind.

1) My page does a postback to the server.
2) On server I evaluate whether to return to existing page or leave existing page displayed and open new window with different page

Seems easy enough, I've just not found the key element to make this happen. Anyone found the solution??

MTIA
wardeaux


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
8814
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
6
12140
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page...
2
2980
by: nntp | last post by:
Are there other ways to open multile windows at once? <SCRIPT language="JavaScript"> function open1() { var open1 = window.open('http://google.com/CheckEnviro.pl','','scrollbars=yes,height=600...
6
21390
by: shil | last post by:
I have a server side button that needs to do some preperation and afterwards, if everything goes well, open a new browser with a specific url. I know how to execute javascript from a server side...
2
2629
by: John at Free Design | last post by:
Can anyone help with how to use the Response.Redirect method to open a page in a new instance of the browser. In this case it is a report. When the user selects a report from a list then I want...
6
10019
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
6
1830
by: Charlie Garrett-Jones | last post by:
i have a server side generated web application that provides parameter forms and always opens the associated reports in a new browser window. the code that controls the opening of the new browser...
6
12063
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the...
2
8469
by: H. Rodriguez | last post by:
Hello, I would like to be able to open a new IE window on the client side and display a PDF document in the new window. Many tutorial sites that I have checked suggest opening a new IE window...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.