Poping up a window AND redirecting the page thtat triggered the po

Discussion in 'ASP .Net' started by =?Utf-8?B?UmljYXJkbyBWaWRlaXJh?=, Dec 15, 2005.

  1. Hi to all. I'm having trouble with the following situation:

    I have a page where the user inserts some stuff and when he clicks on the
    submit button a popup window showing that info is launched and the page "A"
    where he was is redirected to another page, page "B". This page "B" can also
    be accessed by other means. Can this be done? If so, how?

    I was trying to do this:

    protected void button_Click(object sender, EventArgs e)
    {
    string popupScript = String.Format("<script language='javascript'>" +
    "window.open('ShowReport.ashx','CustomPopUp'," +
    "'width=600, height=500, menubar=no, resizable=yes,
    toolbar=no,
    location=no, statusbar=no, left=212, top=184')</script>");

    Page.RegisterStartupScript("ShowReport", popupScript);
    Page.Response.Redirect("NewPage.aspx");
    }


    But what happens is that I get imediatly redirected to the NewPage.aspx. If
    I'm not wrong, this happens because the current page isn't reloaded after
    this event is treated. What I am asking is, for the effect I want (both the
    pop-up and the redirect occurs) what can I do? I have also thought on trying
    to open the pop-up on the loading of NewPage.aspx, by passing some specific
    value when I make the redirect (something like
    Response.Redirect("NewPage.aspx?popup=yes").
    Any ideas/sugestions?

    Thanks in advance
     
    =?Utf-8?B?UmljYXJkbyBWaWRlaXJh?=, Dec 15, 2005
    #1
    1. Advertising

  2. Hi Ricardo,

    The popup window must be generated on the client. This means that the page
    must be loaded to generate the popup. What you can do is to have the page
    pop up a window, and then submit back to the server, where the Redirect can
    occur.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    You can lead a fish to a bicycle,
    but it takes a very long time,
    and the bicycle has to *want* to change.

    "Ricardo Videira" <> wrote in
    message news:...
    > Hi to all. I'm having trouble with the following situation:
    >
    > I have a page where the user inserts some stuff and when he clicks on the
    > submit button a popup window showing that info is launched and the page
    > "A"
    > where he was is redirected to another page, page "B". This page "B" can
    > also
    > be accessed by other means. Can this be done? If so, how?
    >
    > I was trying to do this:
    >
    > protected void button_Click(object sender, EventArgs e)
    > {
    > string popupScript = String.Format("<script
    > language='javascript'>" +
    > "window.open('ShowReport.ashx','CustomPopUp'," +
    > "'width=600, height=500, menubar=no, resizable=yes,
    > toolbar=no,
    > location=no, statusbar=no, left=212, top=184')</script>");
    >
    > Page.RegisterStartupScript("ShowReport", popupScript);
    > Page.Response.Redirect("NewPage.aspx");
    > }
    >
    >
    > But what happens is that I get imediatly redirected to the NewPage.aspx.
    > If
    > I'm not wrong, this happens because the current page isn't reloaded after
    > this event is treated. What I am asking is, for the effect I want (both
    > the
    > pop-up and the redirect occurs) what can I do? I have also thought on
    > trying
    > to open the pop-up on the loading of NewPage.aspx, by passing some
    > specific
    > value when I make the redirect (something like
    > Response.Redirect("NewPage.aspx?popup=yes").
    > Any ideas/sugestions?
    >
    > Thanks in advance
    >
     
    Kevin Spencer, Dec 15, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?UmljYXJkbyBWaWRlaXJh?=

    Bruce Barker Guest

    if a page has a redirect header (produced by calling Redirect), the browser
    will not render the html, if you want the html rendered, you need to use a
    meta tag with a refresh. also popup blocks will prevent you popup window
    anyway. you should change the button to a html hyperlink that opens the
    report.


    -- bruce (sqlwork.com)


    "Ricardo Videira" <> wrote in
    message news:...
    > Hi to all. I'm having trouble with the following situation:
    >
    > I have a page where the user inserts some stuff and when he clicks on the
    > submit button a popup window showing that info is launched and the page
    > "A"
    > where he was is redirected to another page, page "B". This page "B" can
    > also
    > be accessed by other means. Can this be done? If so, how?
    >
    > I was trying to do this:
    >
    > protected void button_Click(object sender, EventArgs e)
    > {
    > string popupScript = String.Format("<script
    > language='javascript'>" +
    > "window.open('ShowReport.ashx','CustomPopUp'," +
    > "'width=600, height=500, menubar=no, resizable=yes,
    > toolbar=no,
    > location=no, statusbar=no, left=212, top=184')</script>");
    >
    > Page.RegisterStartupScript("ShowReport", popupScript);
    > Page.Response.Redirect("NewPage.aspx");
    > }
    >
    >
    > But what happens is that I get imediatly redirected to the NewPage.aspx.
    > If
    > I'm not wrong, this happens because the current page isn't reloaded after
    > this event is treated. What I am asking is, for the effect I want (both
    > the
    > pop-up and the redirect occurs) what can I do? I have also thought on
    > trying
    > to open the pop-up on the loading of NewPage.aspx, by passing some
    > specific
    > value when I make the redirect (something like
    > Response.Redirect("NewPage.aspx?popup=yes").
    > Any ideas/sugestions?
    >
    > Thanks in advance
    >
     
    Bruce Barker, Dec 16, 2005
    #3
    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. Buz Waitz

    popup not poping

    Buz Waitz, Jun 15, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    418
    Buz Waitz
    Jun 16, 2004
  2. Satya
    Replies:
    4
    Views:
    12,045
    Satya
    Jan 23, 2006
  3. Gouse
    Replies:
    2
    Views:
    347
    Kenny McCormack
    Dec 4, 2006
  4. Replies:
    11
    Views:
    1,206
    Default User
    Mar 5, 2007
  5. Graham J
    Replies:
    2
    Views:
    110
    Graham J
    Sep 20, 2003
Loading...

Share This Page