473,795 Members | 3,386 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 4081
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******@bells outh.net> wrote in message news:ed******** ******@TK2MSFTN GP10.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 RegisterStartup Script 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_SP AM_4_MEyahoo.co m> wrote in message
news:e3******** ******@TK2MSFTN GP10.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****@discuss ions.microsoft. com> wrote in message
news:67******** *************** ***********@mic rosoft.com...
Use RegisterStartup Script 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 RegisterStartup Script 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****@discuss ions.microsoft. com> wrote in message
news:67******** *************** ***********@mic rosoft.com...
Use RegisterStartup Script 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
8851
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 (same folder). The cookie is not received. Can someone explain why? I worked around this by adding a cache-control header with a value of no-cache. This fixes the problem. Unfortunately that causes another problem with Internet Explorer...
6
12178
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 where I can set the window height, statusbar=no, etc? Thanks, -Luke
2
3002
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 ,width=800,resizable=yes'); } function open2() { var open2 =
6
21412
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 control, adding the javascript to the attributes. I need to open the browser window AFTER the code behind event is finished. For example I have two text boxes on the form, whose values I want to send as parameters to the URL that I want to...
2
2657
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 to display the report but when they close the report the resport list window (browser) should stay open. Any help would be greatly appeciated. Thanks. -- John at Free Design
6
10035
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 the client machine, the file type TIFF is associated with Kodak Imaging Preview. This app works on most client machines. When you click on the link, Kodak Imaging Preview will open the TIFF file on the client machine. However, on some machines, the...
6
1846
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 window is simply html target='_blank'. but now there is some business rules that may be checked server side only. so if the data provided fails, i want the same target window as the parameter form and if it passes i want a new window. can anyone...
6
12079
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 link.actually i 'm using link button control to diplay the hyperlinks.i cant use java script "window.open()".i need some server side code behind the linkbutton,if any one knows plz rply soon.
2
8483
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 using client-side JavaScript and the window.open() function. I suspect this is not the desired way as I would like to output a PDF report from a byte array to the HTTP output stream to this new window. Any ideas?
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10437
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4113
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 we have to send another system
2
3723
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.