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
995
How to close the WebDialogWindow from a server side function on the content page...
posted

I have seen post on this but nothing that explains in a simple way how this is done. My main page launches a modal WDW and in that ASPX page the user can click on a button "btnApprove". That button has a btnApprove_Click server side event in which I want do do this:

Protected Sub btnApprove_Click(...) Handles btnApprove_Click

 'MARK THE OBJECT AS APPROVED

myobject.Approve

'CLOSE THIS MODAL DIALOG

<< HERE IS WHERE THE PROBLEM IS ?? >>

Any straight forward simple steps would be great.

  • 1185
    posted

    It took me a while - I needed to do the same thing, but I tracked it down:

    Put this in your server side button event:

                    if (!ClientScript.IsStartupScriptRegistered("closeDialogWindow"))
                    {
                        Page.ClientScript.RegisterStartupScript
                            (this.GetType(), "closeDialogWindow", "closeDialogWindow();", true);
                    }               
                    break;

    And this in the page being refreshed:

            function closeDialogWindow() {
                var dialogWindow = $find('<%=dlgWindow.ClientID%>');
                dialogWindow.set_windowState($IG.DialogWindowState.Hidden);
            }

    This trick is that the function is only registered as an event when the button is clicked - and so long as you remove that reference in any other postbacks, its a one off action.