Hide RadWindow

5 posts, 0 answers
  1. Augusto Cosatti
    Augusto Cosatti avatar
    32 posts
    Member since:
    Jul 2009

    Posted 29 Oct 2009 Link to this post

    Hello.

    When you open a modal ASP.NET form with the "window.showModalDialog" javascript method and the dialog window closes itself with a return value of zero and you return that value to the parent page, control is returned to the parent calling web page without any postback. This is the case when you set a client script for the OnClientClick property of a LinkButton for instance.

    I would like to do the same with RadWindow.
    When I open a RadWindow and I push the ESCAPE key the window is closed quickly.
    When I close the window like it is explained in the "programming-using-radwindow-as-dialog.html" documentation page, it works but closing the window is slower than with the ESCAPE key. No postback is generated to the parent page but it looks like it was (the activity progress bar is displayed in IE).

    How can I close the window like the ESCAPE situation ?

    Thanks for your help

    Augusto
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Oct 2009 Link to this post

    Hi Augusto,

    Have you tried the client side code shown below in order to close the window?

    javascript:
     
    <script type="text/javascript"
        function closeWindow() { 
            var oWnd = GetRadWindow(); 
            oWnd.close(); 
        } 
        function GetRadWindow() { 
            var oWindow = null
            if (window.radWindow) 
                oWindow = window.radWindow; 
            else if (window.frameElement.radWindow) 
                oWindow = window.frameElement.radWindow; 
            return oWindow; 
        }   

    -Shinu.
  3. Augusto Cosatti
    Augusto Cosatti avatar
    32 posts
    Member since:
    Jul 2009

    Posted 29 Oct 2009 Link to this post

    Hi Shinu.

    Yes, I'm closing the window like in your example. It works.
    But try yourself to open the window and then push the ESCAPE key and they try to open it and close it with a call to the "closeWindow" function.

    You will notice that closing the window with ESCAPE is faster than with the closeWindow method.

    Don't you agree ?

    Augusto
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 02 Nov 2009 Link to this post

    Hello Augusto,

    Yes, this is true and expected. However, you can't make the closing of the RadWindow faster from a button -  when you click the button, the browser checks the onclientclick event handler, executes the GetRadWindow() function that gets a reference to the window object and call its close method - all these actions take a couple of miliseconds more.


    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Augusto Cosatti
    Augusto Cosatti avatar
    32 posts
    Member since:
    Jul 2009

    Posted 03 Nov 2009 Link to this post

    Shinu,

    I understand what mean.
    Is there a function I could set on the OnClientClick property that what close the window as if I close the window with the Escape key ?
    In other words, is it possible to bypass the normal onclick handling and simulate the ESCAPE key the the OnClientClick event is raised ?

    Thanks
    Augusto
Back to Top