Refresh Parent Page

B

Ben Schumacher

How can I refresh the parent page from a popup window that was created using
window.showmodaldialog? I would like to accomplish this using vbscript if
possible.
 
W

Winista

You can always use java script to refresh the parent page...

window.opener.callMyRefreshFunction();
 
B

Ben Schumacher

I don't want to call call a routine on the parent page. I want to handle
everything in the modaldialogwindow popup window.
 
W

Winista

I was just giving an example of calling routine. You can access any JS
variables (control instances etc.)on parent page from child window. You will
have to do it via JS.
What exactly you are trying to do then I may be able to give you more
specific answer about refreshing UI on parent page.
 
B

Ben Schumacher

Ok. I have a page with a gridview control which is used to display a list
of records in a database table(s). If the user wants to add a new record,
they click "new" and a popup window displays. The popup window accepts data
from the user (name, number, date, etc) and is then submitted back to the
server when the users clicks an ok button. At this point I want to update
the database with the new record, close the popup window, and then refresh
the parent page so that it reflects the newly added record that was created
using the popup window.
 
B

Ben Schumacher

when i just try to look at what the href property is of the opener object
i'm getting Object required: 'window.opener'. Here is the code I'm using in
the popup window that is created using window.showmodaldialog.

<script language="vbscript" type="text/vbscript">

Sub window_onload()

document.write(window.opener.location.href)

End Sub

</script>

Any more ideas?
 
C

carl

Ben,

Unfortuntately, Window.Opener isn't an object when you use
Showmodaldialog. To access the opener window object you can pass a
reference to it like this:

<parent-page>
window.showModalDialog( 'modal_window.aspx', window, '' );
</parent-page>

<modal-window>
var parentWindow = window.dialogArguments;
document.write(parentWindow.location.href);
</modal-window>

This may not work on all browsers, check documentation for browser
support other than IE.

I hope this helps,
Carl
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top