Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
Close WebDialogWindow from button on ContentURL
posted

I have a WebDialogWindow which displays a ContentURL.
On the ContentURL form, I have a button.  How do I close the WebDialogWindow when I click the button on the ContentURL from?

Parents
No Data
Reply
  • 28464
    posted

    Hello,

    I played a bit with the scenario and was able to make this work. Here is my setup - I start with a WebDialogWindow instance in one page (Default.aspx) and then set the ContentPane - ContentUrl property to point to another page:

                <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px" Width="400px">
                    <ContentPane ContentUrl="default2.aspx">              
                    </ContentPane>
                </ig:WebDialogWindow>

    In the content Default2.page, I have the following script and content:

             <script language="javascript">
            
            function closeWindow()        
            {
                var dialogWindow = this.parent.$find("WebDialogWindow1");
                dialogWindow.hide();
            }
            
            </script>
        
            <a href="#" onclick="closeWindow()">Close Parent Window</a>
       

    So basically, the idea is to look for the "parent" property of the content window. The really tricky part is that sometimes the ClientID of the dialog window will not be equal to the server ID. So, you may need to store the client ID of the window in a hidden field in the parent page, e.g.

    <input type=hidden id=windowClientID value=<%= WebDialogWindow.ClientID %> />

    and then get it from the content page and use it as an ID. 

Children