|
-
Apr 19th, 2005, 10:21 AM
#1
Thread Starter
Fanatic Member
Redirect to URL in a new window?
In VB.NET code in an ASP.NET project, I can call:
VB Code:
Response.Redirect("NewPage.apsx")
And this directs me to "NewPage.aspx" in my current browser window. But how can I open this URL in a new window rather than the current one?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 19th, 2005, 10:30 AM
#2
Hyperactive Member
Re: Redirect to URL in a new window?
You can only open a new window client-side, so send a javascript inline command via the buffer.
Last edited by GlenW; Apr 19th, 2005 at 10:31 AM.
Reason: Bad spelling
-
Apr 19th, 2005, 10:33 AM
#3
Thread Starter
Fanatic Member
Re: Redirect to URL in a new window?
That's ridiculous!?!
My form is serverside, therefore all my controls are serverside. You mean I can't possibly open in a new window then?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 19th, 2005, 10:36 AM
#4
Hyperactive Member
Re: Redirect to URL in a new window?
Sorry that's the way it is, but sending inline javascript only takes a couple of lines of code.
-
Apr 19th, 2005, 10:37 AM
#5
Thread Starter
Fanatic Member
Re: Redirect to URL in a new window?
 Originally Posted by GlenW
Sorry that's the way it is, but sending inline javascript only takes a couple of lines of code.
Can I do that from a webcontrol button that is run at the server?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 19th, 2005, 10:40 AM
#6
Hyperactive Member
Re: Redirect to URL in a new window?
Yes just send the javascript via Response.Flush after putting the script in the Buffer.
Make sure you pad the buffer first 'cos it won't flush if its contents are too small and your script will be too small.
-
Apr 19th, 2005, 10:44 AM
#7
Thread Starter
Fanatic Member
Re: Redirect to URL in a new window?
Do you know if it works with vbscript?
Using the buffer is completely new to me...any code example would be greatly appreciated...
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 19th, 2005, 10:49 AM
#8
Hyperactive Member
Re: Redirect to URL in a new window?
Code:
Response.Write("<script language=javascript>window.open('PageToOpen.aspx',null, 'height=550, width=800, status=no, toolbar=no, menubar=no, location=no');</script>");
Response.Flush();
This is for javascript in C# shouldn't be too hard to port.
-
Apr 19th, 2005, 10:50 AM
#9
Hyperactive Member
Re: Redirect to URL in a new window?
Also my syntax may be awry as haven't been able to test it.
-
Apr 19th, 2005, 10:51 AM
#10
Thread Starter
Fanatic Member
Re: Redirect to URL in a new window?
I see. Thankyou very much!
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|