473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Redirect to a new window

Basically how do I set "Target=_blank" on a url string and can it be used by
any of the following

Response.Redirect()
Server.Transfer()
PostBackURL on a link button.

So far the ONLY way I know how to do this is with an old <a href ..tag
Jul 9 '06 #1
3 1347
V
All of these are server side controls, and since it doesn't make sense
for a new window to open on the server, the target=_blank won't work.

What you can do is that you can have a mechanism through which you can
insert javascript into a page where you want a new window to open up,
and this javascript does the job for you.

- V
Sean wrote:
Basically how do I set "Target=_blank" on a url string and can it be used by
any of the following

Response.Redirect()
Server.Transfer()
PostBackURL on a link button.

So far the ONLY way I know how to do this is with an old <a href ..tag
Jul 9 '06 #2
When the request is sent to the server, it's decided where the target
for the response is. As both Response.Redirect and Server.Transfer are
executed on the server, it's too late to change the target.

A postback is done to the same window, therefore a link button is not
equipped to send the post to a different window.

The LinkButton just renders as "an old <a href ...tag" with some
Javascript, but you are limited to what the control was designed to do.
If you use the trusty old anchor tag yourself, you are not limited to a
postback.

Sean wrote:
Basically how do I set "Target=_blank" on a url string and can it be used by
any of the following

Response.Redirect()
Server.Transfer()
PostBackURL on a link button.

So far the ONLY way I know how to do this is with an old <a href ..tag
Jul 9 '06 #3
You can only do target client side - so response.redirect needs to send back
javascript to open a window, transfer in theory would be the same and you
would need to interfere with postback client side to run a javascript open
window command:

<script language="javascript">
function doSomething()
{
// put some javascript code here to open a window
// Continue with submit
this.click();
}
</script>
<asp:button onmousedown="doSomething()" id="Button1" Text="Button"
runat="server"></asp:button>

.......although the result of your postback could in theory be javascript to
open a new window.

Might be easier to use a simple hyperlink and forget about postbacks,
redirects and transfers.

--
Regards

John Timney (MVP)
"Sean" <Se**@discussions.microsoft.comwrote in message
news:F0**********************************@microsof t.com...
Basically how do I set "Target=_blank" on a url string and can it be used
by
any of the following

Response.Redirect()
Server.Transfer()
PostBackURL on a link button.

So far the ONLY way I know how to do this is with an old <a href ..tag

Jul 9 '06 #4

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

Similar topics

3
by: Steven | last post by:
All I want to pop up a window before/during redirect to another page. Sort of a confirmation page: <? .... /* I need to pop up a window here */
1
by: Dwayne | last post by:
I use Respose.Redirect quite a bit but on one of my pages it has an odd behavior. Any time I use it on this page it will come up in a new Window. I didn't even think this was an option and can't...
3
by: eieed | last post by:
I have a web page that is designed to allow users to run crystal reports which are then exported into PDF formats. Currently, when the user clicks the "Submit" button there is some processing to...
5
by: Nazir | last post by:
I am trying to do something pretty simple - but can't see how it can be done in ASP.NET. I have an aspx web page with a form which opens up a new window. The web page uses code behind to build...
3
by: Sehboo | last post by:
On my ASP page, when I click a button, I want to do three things: 1. Check for some values. 2. Open a new window and pass some values as query string. 3. Redirect to some other page Here...
8
by: msnews.microsoft.com | last post by:
I want to redirect the user to a url outside of our website but I want it to preserve our application's window by opening a new window. We have a datagrid that has five hyperlink columns containing...
2
by: news://news.microsoft.com/microsoft.public.de.germ | last post by:
Hallo! Ich habe ein Frameset mit 3 Frames. Im 1. Frame wird eine ASPX-Seite geöffnet. In dieser werden einige Steuerelemente angezeigt. Nun soll bei bestimmten Benutzeraktivitäten eine andere...
1
by: rouellette | last post by:
Is it possible to redirect to another page in your application from the start page BEFORE the user has been authenticated if you're using FORMS authentication? I can't seem to get it to work. ...
1
by: sowen | last post by:
In IE, I am using showModalDialog to pop up a modeless window, then the object "opener" is undefined. well, I pass the parent window object as an argument to pop up, then I can redirect the...
1
by: gnawz | last post by:
Hi guys, I have a couple of php files that perform various tasks. I will use fields in my system and provide code as well I need help as follows: My database contains the fields Category...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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,...

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.