
Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
I understand it can only be accomplished client side. However, I know that
the form tag can include a TARGET="_blank" attribute and, AFAIK, that works.
So it can be accomplished. The only thing is how to make it only that way
for one button.
So I still don't see what I'm missing.

Signature
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
> [top-posting corrected]
>
[quoted text clipped - 8 lines]
> Yes. If you want to open a new window, you have no other choice as that
> action can only be performed client-side...
Scott Roberts - 20 Feb 2008 05:30 GMT
Not sure about using target="_blank", but something I've done in the past is
go ahead and let the button post back as usual then add a startup script in
the button event handler (using RegisterClientStartupScript) to open a new
window using javascript. To pass the processed data, you can put it in an
object (or struct) and stuff it into the session, then read that session
variable from the page opened in the new window.
Just an idea. It may or may not work for your situation.
>I understand it can only be accomplished client side. However, I know that
>the form tag can include a TARGET="_blank" attribute and, AFAIK, that
[quoted text clipped - 15 lines]
>> Yes. If you want to open a new window, you have no other choice as that
>> action can only be performed client-side...
Jonathan Wood - 20 Feb 2008 17:34 GMT
Hi Scott,
> Not sure about using target="_blank", but something I've done in the past
> is go ahead and let the button post back as usual then add a startup
[quoted text clipped - 4 lines]
>
> Just an idea. It may or may not work for your situation.
Certainly more overhead than is ideal, but I suppose that would work. I'll
need to think through that a bit.
Thanks.

Signature
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
lemieux.raphael@csob.qc.ca - 04 Mar 2008 19:23 GMT
Hi,
I did manage to do what you needed by addin the following line of
code to the OnClientClick of a linkbutton :
javascript:var aspnettarget;
aspnettarget=document.forms[0].target;document.forms[0].target='_blank';eval(this.href);document.forms[0].target=aspnettarget;
return false;
I guess you understand what it does, but for others who might
wonder,
aspnettarget=document.forms[0].target; keeps the default
Target of the normal ASP.NET Form
document.forms[0].target='_blank'; Changes the actual
target of the form to _Blank so it opens in a new window
eval(this.href); does a
normal postback of the button to the new target
document.forms[0].target=aspnettarget; Sets back the normal
Target for the ASP.Net Form
return false; Cancel
the "normal" call to the __Postback method since we already called it.
It worked for me just as needed... Hope this helps.
Raphaël LEMIEUX
lemieux.raphael@csob.qc.ca - 04 Mar 2008 19:29 GMT
Hi,
I did manage to do what you needed by addin the following line of
code to the OnClientClick of a linkbutton :
javascript:var aspnettarget;
aspnettarget=document.forms[0].target;document.forms[0].target='_blank';eva
l(this.href);document.forms[0].target=aspnettarget;
return false;
I guess you understand what it does, but for others who might
wonder,
aspnettarget=document.forms[0].target; keeps the default
Target of the normal ASP.NET Form
document.forms[0].target='_blank'; Changes the actual
target of the form to _Blank so it opens in a new window
eval(this.href); does a
normal postback of the button to the new target
document.forms[0].target=aspnettarget; Sets back the normal
Target for the ASP.Net Form
return false; Cancel
the "normal" call to the __Postback method since we already called
it.
It worked for me just as needed... Hope this helps.
Raphaël LEMIEUX