Cause UpdatePanel to refresh on popup window close

Discussion in 'ASP .Net' started by Andy, Apr 18, 2010.

  1. Andy

    Andy Guest

    Hi,

    Ok, I have a page with an updatepanel, which can open a popup. The
    popup can change an object's values which is stored in the session,
    this object is displayed on the main window. I'd like to have the
    updatepanel update when the popup is closed.

    I can't do the update call after window.open, because that returns
    immediately (before the user could possibly edit the settings in the
    popup). I tired having a javascript page level variable to store the
    popup and set its onunloaded to a function defined in the main
    window. That never seems to get called.

    Any ideas? The popup is used on a few different pages, so I can't do
    anything that would tie it to a particular parent page.

    Here's what I have in the parent page:

    function openPopup( popupOpener ) {
    if ( popupWindow == null ) {
    popupWindow = popupOpener();
    popupWindow.onunload = setDirty;
    }
    else {
    alert( 'Please close the existing popup editor and try again');
    }
    }

    popupOpener is a function which simply does { return
    window.open( ... ); }

    setDirty should initiate the updatepanel refresh, but its not being
    called.

    Thanks
    Andy
     
    Andy, Apr 18, 2010
    #1
    1. Advertising

  2. "Andy" <> wrote in message
    news:...
    > Hi,
    >
    > Ok, I have a page with an updatepanel, which can open a popup. The
    > popup can change an object's values which is stored in the session,
    > this object is displayed on the main window. I'd like to have the
    > updatepanel update when the popup is closed.
    >
    > I can't do the update call after window.open, because that returns
    > immediately (before the user could possibly edit the settings in the
    > popup). I tired having a javascript page level variable to store the
    > popup and set its onunloaded to a function defined in the main
    > window. That never seems to get called.
    >
    > Any ideas? The popup is used on a few different pages, so I can't do
    > anything that would tie it to a particular parent page.


    In a popup to another window, you can talk back to the parent window in
    JavaScript and send it some info that fires off the AJAX. Another option is
    to have the modal popup in a DIV on the same page. Wiring this way makes it
    quite easy to wire an action on the DIV to an AJAX call, as you have the
    control in the same window. In fact, you can wire the control to AJAX on the
    server side and then only show the DIV when necessary. Much easier, but it
    may not fit your requirements.

    --
    Peace and Grace,
    Greg

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    ************************************************
    | Think outside the box! |
    ************************************************
     
    Gregory A. Beamer, Apr 21, 2010
    #2
    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. Matt Jensen
    Replies:
    1
    Views:
    5,235
    Matt Jensen
    Dec 16, 2005
  2. Replies:
    3
    Views:
    481
    Rob Meade
    Aug 8, 2007
  3. J P Singh
    Replies:
    3
    Views:
    312
    Howard Rothenburg
    Feb 11, 2004
  4. Jens Peter Hansen
    Replies:
    7
    Views:
    546
    Randy Webb
    Jun 19, 2004
  5. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    381
    GĂ©rard Talbot
    Sep 2, 2005
Loading...

Share This Page