Beginner Question

J

Jeremy

How can I call another webform as a new window, as opposed to replacing the
content of the current window?
I need to be able to do this from code (eg. Server.Transfer) or implicitly
behind a hyperlink.

Thanks in advance.
 
K

Kevin Spencer

You need to use Page.RegisterStartupScript() (on the server) to register a
JavaScript on the page that will run as soon as the page loads in the
browser. Something like:

Dim str As String = "<script
type=""text/javascript"">window.open('somepage.aspx?queryString=whatever');<
/script>"
If Not Page.IsStartupScriptRegistered("OpenWindow") Then
Page.RegisterStartupScript("OpenWindow", str)
End If

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
J

Jeremy

It's really that complicated ??

Kevin Spencer said:
You need to use Page.RegisterStartupScript() (on the server) to register a
JavaScript on the page that will run as soon as the page loads in the
browser. Something like:

Dim str As String = "<script
type=""text/javascript"">window.open('somepage.aspx?queryString=whatever');<
/script>"
If Not Page.IsStartupScriptRegistered("OpenWindow") Then
Page.RegisterStartupScript("OpenWindow", str)
End If

--
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
J

Joao S Cardoso [MVP]

It's really that complicated ??

Yes it is...

You must understand that while you are working with a new platform (ASP.NET) on
the client the browser its the same... and basically what the client gets is
HTML. So you need to use the same tricks on the client side as you used with ASP
3.0 for instance. The good thing is that you have the tools in .NET to do it, as
Kevin demonstrated.

Joao Cardoso (MVP dotNET)
=======================================================
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
(e-mail address removed)-s.p-a.m - www.acinet.pt
=======================================================
 
K

Kevin Spencer

It's really that complicated ??

No, it's really that simple. There are quite a few things more complicated
than that with ASP.Net.

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top