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

Client side functions are undefined for radwindow

4 Answers 145 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tao
Top achievements
Rank 1
Tao asked on 21 May 2014, 11:21 PM
Hi,

I'm opening a radwindow from within a radwindow. I want to use some of the client side functionsm like, center(), set_modal(). But when I run it, the webpage throws error says these functions are undefined. I'm using the following code. Also, is there a way to set radwindow skin using client code.

Thanks!

01.function GetRadWindow() {
02.        var oWindow = null; if (window.radWindow)
03.            oWindow = window.radWindow; else if (window.frameElement.radWindow)
04.            oWindow = window.frameElement.radWindow; return oWindow;
05.    }
06. 
07.    function openWinTest() {
08. 
09.        //store the overflow   
10. 
11.        bodyOverflow = document.body.style.overflow;
12. 
13.        htmlOverflow = document.documentElement.style.overflow;
14. 
15.        //hide the overflow   
16. 
17.        document.body.style.overflow = "hidden";
18. 
19.        document.documentElement.style.overflow = "hidden";
20. 
21.        var oBrowserWnd = GetRadWindow().BrowserWindow;
22.       
23. 
24.        var url = "www.google.com"
25. 
26.        oBrowserWnd.radopen(url, "", 1100, 620);
27.        oBrowserWnd.center()
28.        oBrowserWnd.set_modal(true);
29.    }

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 May 2014, 05:17 AM
Hi Tao,

Please try the below JavaScript code to open a RadWindow from another RadWindow.

JavaScript:
function OpenInnerWindow(sender, args) {
    var oBrowserWnd = radopen('http://www.telerik.com', null);
    oBrowserWnd.center();
    oBrowserWnd.set_modal(true);
}

Thanks,
Princy.
0
Tao
Top achievements
Rank 1
answered on 22 May 2014, 04:53 PM
Hi Princy,

It doesn't work the way I want it to be. The reason I use GetRadWindow().BrowserWindow is that I want the inner radwindow moves outside the parent window. I'm using this method here. The problem is client side functions will not work in this way.

Thanks!

0
Marin Bratanov
Telerik team
answered on 23 May 2014, 11:06 AM

Hello Tao,

When you use the radopen() function, it returns a reference to the RadWindow it just opened, as explained here: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.

Thus, you can use its client-side API on that object, not on the browser window object that the BrowserWindow field returns: https://developer.mozilla.org/en/docs/Web/API/Window.

In this regard, Shinu's example is correct, only I would name the variables in a more intuitive way to avoid confusion.

I am attaching a sample that illustrates this. Also, I am attaching another one that shows how to create parent-child relationships if you need to return data.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tao
Top achievements
Rank 1
answered on 27 May 2014, 10:21 PM
This is very helpful! Thank you!
Tags
Window
Asked by
Tao
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Tao
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or