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?
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.
Thanks Rumen, however, I have a "Send Mail" button on my page that runs server side code to send an email. So when the email is sent, I would like to close the webdialog from the server side code...any ideas?