After onclick code runs, open new window, close self?

Discussion in 'ASP .Net' started by Kathy Burke, Oct 15, 2003.

  1. Kathy Burke

    Kathy Burke Guest

    Hi, could have sworn I used this before and don't understand why this
    isn't working?

    I have a button with onclick event:

    do some database updates, etc.

    then, open a new window (a confirmation that updates are done) and close
    the current form.

    If lreturn2 <> -1 Then

    Response.Write("<script
    language=javascript>parent.right.location='ErrorMsgEmail.aspx'</script>"
    )

    Else
    'load confirmation page
    Response.Write("<script
    language=javascript>window.opener.location='UserMsgTimerClose.aspx';self
    .close()</script>")

    End If

    In debug (vb.net), the Response.write line in Else gets highlighted but
    then the form just "appears" and ignores it. I tried putting a variable
    on page load (if postback) but the page doesn't reload after "submit".

    Admittedly, a bit confused, if anyone is in the mood to enlighten me?

    Thanks, Kathy

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Kathy Burke, Oct 15, 2003
    #1
    1. Advertising

  2. Kathy Burke

    Paul W Guest

    Not sure why you want to close "_self", I would think it's kind of dangerous
    if you are persisting anything with Session State variables.

    Here is the code I use to open new window

    Response.Write("<script language=javascript>")
    Response.Write("window.open('someform.aspx', 'somewindowname', 'toolbar=no,
    other window options...');")
    Response.Write("</script>")

    Hope this helps
    Paul W
     
    Paul W, Oct 15, 2003
    #2
    1. Advertising

  3. Kathy Burke

    Kathy Burke Guest

    Hi, I need to close the opener window...it is the end of what the user
    will do (internal app).

    That exact script worked in another page, just wondering what
    circumstances might be where it would be prevented from
    working...mystery to me.

    Thanks,
    Kathy

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Kathy Burke, Oct 16, 2003
    #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. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    584
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    598
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    404
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    379
    falcon
    Jul 31, 2005
  5. Walter Beierdonck

    Self.close() window without the dialog close?Yes/NO

    Walter Beierdonck, Apr 29, 2004, in forum: Javascript
    Replies:
    1
    Views:
    347
    Grant Wagner
    Apr 30, 2004
Loading...

Share This Page