I would like to develop the popup window in a separate aspx page so that all the code is self contained here, however how do I close the dialog from a OK button or Cancel button that is contained within the separate aspx page?
Currently the examples show creating the popup window all in one aspx page, so the Ok button can call a local javascript click event and call Hide on the dialog control.
Thanks ...
I think I figured out a workaround now... Its to create an iFrame inside ModalTemplate section and throw in OK CANCEL buttons under the iFrame like this:
<igweb:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="350px" Modal="True" Width="845px" WindowState="Hidden" InitialLocation="Centered" Movable="false">
<Header CaptionText="Add New Account"><CloseBox Pressed="True" /></Header>
<ContentPane BackColor="white">
<Template> <iframe id="frameAddNew" runat="server" width="100%" src="SomePage.aspx?some=somethingelse" height="300"></iframe><input id="Button1" type="button" value="Cancel" onclick="DialogAddCancel()" /> </Template>
<Template>
<iframe id="frameAddNew" runat="server" width="100%" src="SomePage.aspx?some=somethingelse" height="300"></iframe><input id="Button1" type="button" value="Cancel" onclick="DialogAddCancel()" />
</Template>
</ContentPane>
</igweb:WebDialogWindow>
function DialogAddCancel(){oWebDialogWindow1.hide(); }
Looks like you've got the right idea. You've got to call back to the parent page to some close function to close the dialog from another aspx page.
Parent page:
function btnShow_onclick() { var dialog = $find("WebDialogWindow1"); dialog.show(); }
window.parent.CloseDialog();
I don't believe you need to create another iframe within WebDialogWindow, just set the ContentPane property of ContentURL and the control does all the rest for you.
Thanks for replying ...
Thanks, works great. Except instead of using control name straight, I think using control ClientId will be a good idea especially if you are working with content pages:
function CloseDialog(){var dialog = $find("<%=WebDialogWindow1.ClientID %>");dialog.hide();}
This already bit me... so by using .ClientId it did the trick.
So now I have removed the iFrame and back to using the ContentPane/ContentURL instead. Super duper!