tags:

views:

23

answers:

2

Hi I have a asp.net ajax app. I have one modelpopup that shows a IFrame and inside Iframe I show one asp.net page. I want to hide the modelpopup when user click on close button in page inside IFrame. How can I find the opener modalpopup?

Thanks

A: 

with simple javascript you can access the top window javascript values or functions by using the window.top.document, for example:

 window.top.FunctionToRun();

and find elements by

window.top.document.getElementById("ControlIdToFindOnParent")

or direct

window.top.document.forms[0].ControlNameOnParent

If you using jQuery you can use the

jQuery("#ControlIdToFindOnParent", window.top.document)
Aristos
+1  A: 

You can reload the page from javascript, this will close the popup, and reload the data on the page. If the main page was a listview and the popup edited one of the items in the list, the reload also updates the edited item.

window.top.location.href = window.top.location.href;

No need to target a function of the parent page.

Willem
thanks for your answer.
Ashian