I’m using a WebDialogWindow to popup a modal window. It is attached to a parent form. It is actually an editor for more than one form. The modal window has naturally a close button in the top right-handcorner, however I have added another close button of my own. This button that I added does not raise the ‘WindowStateChange’ event on the parent form. Nor have found any way to access the parent form from the modal window page code behind. (.parent = nothing or null master is the same). It is different if use the ‘X’ in the top right-hand corner. It triggers the post-back. Then I can write the new information that was changed to the parent-form on post-back. Ultimately my modal window edits something on the parent, and when it closes I want to refresh the parent with the new information. But doing that seems easier than saying it.
Parent Page Code:
<ig:WebDialogWindow ID="popViewDocument" runat="server" Height="600px" InitialLocation="Centered" Modal="True" Width="800px" WindowState="Hidden" OnStateChanged="popViewDocument_StateChanged" >
<AutoPostBackFlags WindowStateChange="On" />
<Header CaptionText="Patient Edit" runat="server">
</Header>
</ig:WebDialogWindow>
Protected Sub popViewDocument_StateChanged(ByVal sender As Object, ByVal e As Infragistics.Web.UI.LayoutControls.DialogWindowStateChangedEventArgs) Handles popViewDocument.StateChanged
If e.NewState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Hidden Then
…>>>>>> Only gets triggered on ‘X’ click – Why not a button click???!
Close button code on Modal popup page:
Protected Sub btClose_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCloseForm.Click
If Not ClientScript.IsStartupScriptRegistered("closeDialogWindow") Then
Page.ClientScript.RegisterStartupScript(Me.GetType(), "closeDialogWindow", "closeDialogWindow();", True)
End If
End Sub
>>>Javascript<script type="text/javascript">
function closeDialogWindow() {
var dialogWindow = this.parent.$find("MainContent_popViewDocument");
dialogWindow.hide();
}
</script>
Thankx,
Robert Koernke
Hello Robert,
StateChanged event should be fired always when you change the window state. Otherwise this can be thread as an issue.
You can use: var dw = $find('<%= popViewDocument.ClientID %>');dw.show(); //dw.hide();http://forums.infragistics.com/forums/p/46189/250279.aspx#250279
Hope this helps
The link sent seems to be not much to do with the context of this discussion. Notice that I'm trying to trigger a postback upon change of the state of the WebDialogWindow. As stated originally this does work if I click the 'X' in the top right-hand corner. But does not trigger if I create my own button on the form.
Just FYI:
By the way I didn't mention that the contents of the WebDialogWindow's contents actually come from another document .aspx - by setting the 'contentPane.set_contentUrl'. But I don't think that should make a difference. However that is why my '$find' statement is formatted the way it is above. But this should not affect my overall problem/question.
Sincerely,
Ok I figured it out!The other option you gave: dw.set_windowState($IG.DialogWindowState.Normal, true); was key. The .hide or .show doesn't not trigger.Here are a few notes: 1) From the popup page, I could not reference the enum $IG.DialogWindowState. Oddly the intelliisense worked, but at runtime it did not. So I figured out what number it was, and hard-wired it. 2) The __doPostBack is required but, we found it was not necessary to put an event argument in. It didn't matter at all. I tested it and tested it, finally put 'rumplestilskin', and then removed it, and it still worked in the end. It is just sensing that a state of the window was changed. Good!Here is the final code of the popViewDocuments BLOCKED SCRIPT
//---dialogWindow.set_windowState($IG.DialogWindowState.Hidden, true);
dialogWindow.set_windowState(3, true); //Hidden is 3
__doPostBack('MainContent_popViewDocument');
Now this is working. Thank you, Robert Koernke
our developers investigated this issue and found that this is the correct behavior of the control.When application calls a method which changes control, then no client/server events are raised. If application needs to trigger server event, then it may use __doPostBack(id, eventName).
In case of change to dialog-state, application also may use optional 2nd parameter in set_windowState method, which will trigger raising corresponding client and server events. Below are examples for those 2 options:function Button1_onclick() {var dw = $find('<%= popViewDocument.ClientID %>');dw.set_windowState($IG.DialogWindowState.Normal, true);//or//dw.show();//__doPostBack('popViewDocument', 'WindowStateChanged');}
I investigate this more detail and can confirm that this is a development issue. I have logged it in our internal tracking system with a Development ID of 94885. I also have created support ticket CAS-76107-32RKRL