Open page in new window instead of using redirect

M

moondaddy

I need to open a page in a new window from the code behind. Normally I use
response.redirect to navigate to a new page but up to now its always been in
the same window. I know how to do it from JavaScript in the browser, but
this logic needs to run from the server.

Any good ideas?
 
R

Raterus

You'll have to write out a script that runs when the page loads to switch the page, you can't open a new browser from the server. The Page.RegisterStartupScript() method would work great for this.
 
A

ashelley

I need to open a page in a new window from the code behind. Normally I use
response.redirect to navigate to a new page but up to now its always been in
the same window. I know how to do it from JavaScript in the browser, but
this logic needs to run from the server.

Any good ideas?

this.RegisterClientScriptBlock("","<script language='JavaScript'>
window.showModalDialog('url','mynewwindow','myoptions');</script>");

-adam
 
B

Bobby Ryzhy

Write javascript from your codebehind and add it to the page.controls
collection.

example:
Page.Controls.Add(new LiteralControl("<script language =
\"javascript\">"));
Page.Controls.Add(new LiteralControl(window.open("xyz.htm");));
Page.Controls.Add(new LiteralControl("</script>"));

Bobby Ryzhy
(e-mail address removed)
http://www.weekendtech.net
 
B

bruce barker

this approach will not work with xp service pack 2 , due out shortly

-- bruce (sqlwork.com)
 
G

Guest

Try this

Response.Write("<script
type='text/javascript'>detailedresults=window.open('..Your Page
Here...');</script>")
 

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
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top