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.
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.
oops, ignore the break; - I copied this code from a switch() stmt