On the web dialog window, the close form symbol "X".
Is there anyway to capture that event? If someone closes the dialog window?
I would prefer to do something server side if possible.
Hi,
In order to capture state-change events of WebDialogWindow in order to cancel them or implement custom logic, the ClientEvent WindowStateChanging should be used. If event is canceled, then no postback occurs.
That event also can be processed on server, but it does not support "cancel" action similar to client event. However, application may change state back to original or set another desired state of dialog.
Below are examples for both cases:
aspx:
<script type="text/javascript"> function WebDialogWindow1_WindowStateChanging(sender, eventArgs) { var newState = eventArgs.get_newWindowState(); //if (newState == 3) //or if (newState == $IG.DialogWindowState.Hidden) { // put your you custom/validation codes here //if (someCondition) //{ // eventArgs.set_cancel(true); //} } } </script> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px" Width="400px" Modal="true" onstatechanged="WebDialogWindow1_StateChanged"> <AutoPostBackFlags WindowStateChange="On" /> <ClientEvents WindowStateChanging="WebDialogWindow1_WindowStateChanging"></ClientEvents> </ig:WebDialogWindow>
aspx.cs:
protected void WebDialogWindow1_StateChanged(object sender, Infragistics.Web.UI.LayoutControls.DialogWindowStateChangedEventArgs e) { if (e.NewState == Infragistics.Web.UI.LayoutControls.DialogWindowState.Hidden) { this.Label1.Text = "dialog was hidden"; //((Infragistics.Web.UI.LayoutControls.WebDialogWindow)sender).WindowState = e.OldState; //((Infragistics.Web.UI.LayoutControls.WebDialogWindow)sender).WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal; } }
If you can live with it,another suggestion is to eliminate the close button, turn the modal attribute true and handle everything via button events.
I have this working now... i closed my VS2005 and restarted it and now it is working.
Now, i can try to get the references to the WebDataInput text boxes on the .aspx page that i am displaying as the ContentUrl for the WebModalDialog.
thanks
hi;
i too am trying to get the close button to respond to a server-side event ( WindowStateChange ). i have looked at the links suggested above and this is what i have done. i did not understand the help link to the StateChanged Event.
i have set the autopostback flag to true to windowstatechanged event.
and i have created a server-side StateChanged event.
Private Sub WebDialogWindow1_StateChanged(ByVal sender As Object, ByVal e As Infragistics.Web.UI.LayoutControls.DialogWindowStateChangedEventArgs) Handles WebDialogWindow1.StateChanged Stop If e.NewState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Hidden Then If e.OldState <> Infragistics.Web.UI.LayoutControls.DialogWindowState.Hidden Then lblReturnedData.Text = "window is closed" lblReturnedData.Visible = True End If End If End Sub
this event is never being fired. is this all that is necessary to wire-up the StateChanged event?
i do have the _Moved event server-side and it is being fired, however, it is fired after the window is closed.
Stop
End Sub
Thanks for your help.
HI ,
Try wiring up the Server-Side StateChanged event. Then set the Auto PostBackFlag's WindowStateChange to on.
Here is a help link for auto postback flags - which are right off the WDW(WebDialogWindow)
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Web.v8.2~Infragistics.Web.UI.LayoutControls.DialogWindowAutoPostBackFlags_members.html
Here is a help link to the StateChanged Event:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Web.v8.2~Infragistics.Web.UI.LayoutControls.WebDialogWindow~StateChanged_EV.html