Open page in new window instead of using redirect

Discussion in 'ASP .Net' started by moondaddy, Jul 8, 2004.

  1. moondaddy

    moondaddy Guest

    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?

    --
     
    moondaddy, Jul 8, 2004
    #1
    1. Advertising

  2. moondaddy

    Raterus Guest

    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.

    "moondaddy" <> wrote in message news:OLbtv$...
    > 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?
    >
    > --
    >
    >
    >
     
    Raterus, Jul 8, 2004
    #2
    1. Advertising

  3. moondaddy

    Guest

    On Thu, 8 Jul 2004 16:16:20 -0500, "moondaddy" <>
    wrote:

    >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
     
    , Jul 8, 2004
    #3
  4. moondaddy

    Bobby Ryzhy Guest

    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

    http://www.weekendtech.net



    On Thu, 8 Jul 2004 16:16:20 -0500, "moondaddy" <>
    wrote:

    >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?
     
    Bobby Ryzhy, Jul 8, 2004
    #4
  5. moondaddy

    bruce barker Guest

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

    -- bruce (sqlwork.com)


    "Bobby Ryzhy" <> wrote in message
    news:...
    > 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
    >
    > http://www.weekendtech.net
    >
    >
    >
    > On Thu, 8 Jul 2004 16:16:20 -0500, "moondaddy" <>
    > wrote:
    >
    > >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?

    >
     
    bruce barker, Jul 9, 2004
    #5
  6. Try this

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

    "moondaddy" wrote:

    > 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?
    >
    > --
    >
    >
    >
    >
     
    =?Utf-8?B?d2hpZ2dpbnM=?=, Sep 2, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. msnews
    Replies:
    1
    Views:
    599
    Steve C. Orr [MVP, MCSD]
    May 27, 2005
  2. Doogie
    Replies:
    3
    Views:
    866
    Doogie
    Jun 22, 2007
  3. Gordon
    Replies:
    3
    Views:
    345
    Steven Burn
    Apr 16, 2004
  4. PC HUA
    Replies:
    2
    Views:
    472
    PC HUA
    May 19, 2004
  5. Replies:
    1
    Views:
    273
Loading...

Share This Page