This is a migrated thread and some comments may be shown as answers.

[Solved] Hide RadWindow

4 Answers 215 Views
Window
This is a migrated thread and some comments may be shown as answers.
Augusto Cosatti
Top achievements
Rank 1
Augusto Cosatti asked on 29 Oct 2009, 09:45 AM
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

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Oct 2009, 10:07 AM
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.
0
Augusto Cosatti
Top achievements
Rank 1
answered on 29 Oct 2009, 10:14 AM
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
0
Georgi Tunev
Telerik team
answered on 02 Nov 2009, 12:52 PM
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.
0
Augusto Cosatti
Top achievements
Rank 1
answered on 03 Nov 2009, 08:38 AM
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
Tags
Window
Asked by
Augusto Cosatti
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Augusto Cosatti
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or