Opening a new window

B

Bonzol

Vb.Net 2003, 1.1. Web application.

Hey there

I have this,

Response.Redirect("FileFiew.aspx")

to go to a new page, but how do I open that page in a new window? So I
will have 2 pages open,, the original page, and the page I opened.

thanx in advance
 
C

Cor Ligthert [MVP]

Bonzol,

Although it is probably possible, will that give you for sure problems,
ASPNET is based on a chain of pages. You sent and you get pages posted back.
With opening a second page and getting that back you will become for sure in
trouble.

Such a second page is mostly called a PopUp by the way.

Cor
 
M

Maate

Actually, I don't know if it's possible to open a new window with
vb.net - so I guess you'll have to use JavaScript or so. I've written
two examples below. Possibly it's example 2 you need?

- Maate



' Two examples on how to open a window with JavaScript in .NET
'(replace the about:blank with the url)

sub page_load

' 1: Creates a link on the fly with the text 'new window' :
Response.Write("<br><a
onclick=""window.open('about:blank','window2','width=400,height=200');""
href=""#"">new window</a>")

' 2: Opens a window each time you run the line of code:
Response.Write("<script
language=""JavaScript"">window.open('about:blank');</s" & "cript>")

end sub




Cor Ligthert [MVP] skrev:
 
H

Herfried K. Wagner [MVP]

Bonzol said:
Vb.Net 2003, 1.1. Web application.

Hey there

I have this,

Response.Redirect("FileFiew.aspx")

to go to a new page, but how do I open that page in a new window? So I
will have 2 pages open,, the original page, and the page I opened.

You will have to use client-side JavaScript/JScript/VBScript to open a new
window. You can use 'window.open' for this purpose:

'open' Method
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>

Note that opening windows can lead to problems because of popup blockers and
thus opening a new window will require additional interaction by the user to
make the window appear.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top