Ashian
Ashian

Reputation: 531

hide modalpopup from IFrame

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

Upvotes: 1

Views: 2511

Answers (2)

Willem
Willem

Reputation: 5404

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.

Upvotes: 1

Aristos
Aristos

Reputation: 66649

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)

Upvotes: 1

Related Questions