refresh parent window on close showModalDialog?

S

Simon Storr

Is it possible to make the parent window refresh when a modal dialog is
closed? I know I can use

window.opener.location.reload(true);

for a 'normal' window, but this doesn't work for showModalDialog. It is
modal as far as the client is concerned but not the server...

In my app I have a datagrid on the main aspx page, I pop up a modal dialog
to edit a record. On closing the modal dialog I'd like to refresh the
datagrid with the new data.

Simon
 
A

Anatoly

We use showModalDialog a lot.
As solution we put on parent web form server side button with style =
"display:none"
inside client-side function which calls to showModalDialog we "press" this
button in case showModalDialog returns true:

if(showModalDialog(...))
{
document.all("btnRefresh").click();
}

in server-side event onclcik of this button(I called it "btnRefresh") you do
what you want.(rebind etc...)
HTH
 
Joined
Jan 6, 2009
Messages
1
Reaction score
0
Hi
Could you please tell me what is

if(showModalDialog(...)) what is this ... in the parenthesis, i tried it without anything in parenthesis but it doesn't work.:-(

Waiting for your reply
Thanks
FA
 
Joined
Jan 27, 2010
Messages
27
Reaction score
0
Refresh parent page on closing modal child window/popup

Instead, you can put the code to refresh the page just below the line that actually opens the modal popup in the parent page. Since code exceution on parent stops at the point when the modal pop window is opened, the next line is executed only after the modal popup has been closed. So if you put the reload call just below the call to open modal popup, the parent would refresh immediately the modal popup is closed.

Example - To refresh parent page on closing Modal child pop-up window.

....on Parent page

function OpenModalPopUP()
{
window.showModalDialog('page.aspx');
window.location.reload();
}


In the above example the first statement opens a modal popup and pauses the execution as long as the popup is open, the next statement reload() is executed right after the child modal popup window is closed.
 

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,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top