ASP.NET Window - How to control Window from the webpage loaded by Window?

Problem: As we know, when Window loads a page using Url="[link]" or setUrl("[link]"). The loaded page is seperated from main page which contain client-side Window object. How can we make this page able to control Window component at clientside?

Solution: Using javascript to attach Window object to global element.

*Note: This method can only be used when main page and page loaded inside Window are in the same domain. Different domain will cause well-known security issues "Cross-site scripting".

* Click "Open" to open Window


 



ASP.NET
          <owd:Window ... ID="myWindow" Url="innerPage.aspx" OnClientInit="window.myWindow = myWindow;" ... >
          </owd:Window>    
    
Java Script
window.parent.myWindow.Close();