code_junkie

Moving ModalPopup Outside the IFrame. Possible?

Nov 12th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. /* function in the main(parent) page */
  2. var _onMyModalPopupHide = null;
  3. function pageLoad(){
  4. // would be called by ScriptManager when page loads
  5. // add the callback that will be called when the modalpopup is closed
  6. $find('MyModalPopupBehaviorID').add_hidden(onMyModalPopupHide);
  7. }
  8. // will be invoked from the iframe to show the popup
  9. function ShowMyModalPopup(callback) {
  10. _onMyModalPopupHide = callback;
  11. $find('MyModalPopupBehaviorID').show();
  12. }
  13. /* this function would be called when the modal popup is closed */
  14. function onMyModalPopupHide(){
  15. if (typeof(_onMyModalPopupHide) === "function") {
  16. // fire the callback function
  17. _onMyModalPopupHide.call(this);
  18. }
  19. }
  20.  
  21. /* functions in the page loaded in the iframe */
  22. function ShowPopup(){
  23. if(typeof(window.parent.ShowMyModalPopup) === "function") {
  24. window.parent.ShowMyModalPopup.apply(this, [OnPopupClosed]);
  25. }
  26. }
  27. // will be invoked from the parent page .. after the popup is closed
  28. function OnPopupClosed(){
  29. // do something after the modal popup is closed
  30. }
Add Comment
Please, Sign In to add comment