Cause UpdatePanel to refresh on popup window close

A

Andy

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
 
G

Gregory A. Beamer

Andy said:
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! |
************************************************
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top