We help IT Professionals succeed at work.

open a new browser window using response.redirect.

HLRosenberger
on
I have read things about opening a new browser window using response.redirect.

I ran across this (below), add it to the button that does the redirect.  But I cannot get it to work.  Anyone ever use this, or have another thought on opening a new browser window using response.redirect?

OnClientClick="aspnetForm.target ='_blank';
Comment
Watch Question

Most Valuable Expert 2012
Top Expert 2014

Commented:
Use

OnClientClick="window.open('url');"

Author

Commented:
that does not seem to work.
Most Valuable Expert 2012
Top Expert 2014

Commented:
Have you checked if the new window is being blocked by popup blocker?
Commented:
Response.redirect is server-side. Opening a new window is client side. You can not open a new window from the server.

Opening a new window from a form, is done by having the target of the form set to "_blank". A button has no target.
<form action="anotherpage" target="_blank">

You can dynamically set the target of the form with javascript.
<input type="submit" onclick="this.form.target='_blank';">

You have have a button (without a form) open a new window by javascript.
<input type="button" onclick="window.open('newpage.aspx');">


Author

Commented:
This is an excellent explaination.  Thanks
Most Valuable Expert 2012
Top Expert 2014

Commented:
So you will use a form now?