hellow,
I have an issue with closing a WebDialogWindow using a JS code.
so for showing the dialog, I'm using the following vb.net code:
WebDialogWindow9.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal
the above code works fine, and inside that dialog there is a button called (Cancel), this button suppose to close/hide the WebDialogWindow9, so I'm using this JS code:
function closeDialogs() { var win = window.parent; var dialog = win.$find('WebDialogWindow9');
if (dialog) { dialog.hide(); } }
========
<igtxt:WebImageButton ID="WebImageButton2" runat="server" Text="Cancel" Width="135px"> <ClientSideEvents Click="closeDialogs" /> <Appearance> <Image Url="./Res/Actions-button-cancel-icon1.png" /> </Appearance> </igtxt:WebImageButton>
but it does nothing when I click on the button? could you please assist me with this.
Hello,
Another alternative to the show/hide methods is setting the windowState property to either Normal or Hidden, so what you could try is changing the code to:
dialog. .set_windowState($IG.DialogWindowState.Hidden);
The use of these properties has been demonstrated in the WebDialogFrame.aspx file in the following sample:
https://www.infragistics.com/samples/aspnet/dialog-window/confirmation-dialog
Please let me know if you need any further assistance.
Regards, Ivan Kitanov
still having the same issue, no result when I click.
I have created a small sample trying to reproduce the described behavior. I am using WebDialogWindow with version 21.2. On my side everything works as expected and I am able to open/close the dialog by using both show/hide methods and changing the window state. I have tested the sample in Edge, Chrome and Mozilla and there were no issues in all the browsers.
Attached you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce
Looking forward to hearing from you.
WebDialogWindowShowClose.zip
Thanks again for you support, the thing that the webdialog is linked to another form, as the following:
<ig:WebDialogWindow ID="WebDialogWindow9" runat="server" Height="400px" InitialLocation="Centered" Moveable="False" Width="950px" WindowState="Hidden"> <ContentPane ContentUrl="Test.aspx" ScrollBars="Hidden"> </ContentPane> <Header CaptionText="Test"> </Header> </ig:WebDialogWindow>
And that form (Test.aspx) has couple text inputs and 2 buttons, one for saving data and the other one for canceling the changes, which suppose to close the dialog window.
can this work? as I tried to use JS find the webdialog inside the parent page to close it:
var win = window.parent; var dialog = win.$find('WebDialogWindow9');
this code is inside the "Test.aspx"
another thing, the webdialigwindow9 is inside a WebTab tags in the parent page. If this matters.
thanks again
I believe that your scenario is similar to the one discussed in the following forum post, where Viktor has provided a way to find a control that is in different aspx page.
If this doesn’t resolve the issue, it would be best if you could provide a small sample that demonstrates the issue. Please remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Thank you for your cooperation.
here is a sample project
https://seupload.com/vkb/TestWebDialogWindow.rar
Hi,
I’m glad that you found my suggestion helpful and managed to resolve your issue.
Thank you for choosing Infragistics!
Regards,Ivan Kitanov
Thanks Ivan, you solved my issue, i really appreciate your support.
Thank you providing a sample. After some investigation, I’ve come with a very simple solution. Instead of trying to find the WebDialogWindow from the page that is provided as a ContentURL, what it could be done instead is creating a function to close the WebDialogWindow in the parent page and then accessing it from the child page.
The changes that need to be done are as follows:
1) Add the following function to the MainPage.aspx:
function CloseDialogJS() { var dialog = $find('<%= WebDialogWindow1.ClientID %>'); dialog.hide(); }
2) Change the following function in WebForm1.aspx:
function closeDialogs() { window.parent.CloseDialogJS(); }
Please test the following approach and let me know if you have any questions.