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

GetRadWindowManager and $find()

7 Answers 1298 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 03 Nov 2007, 03:45 PM
Hi,

I have been unsuccessful in obtaining a reference to the RadWindowManager via the GetRadWindowManager or the $find() calls.

$find returns null and GetRadWindowManager returns undefined.

Any help would be greatly appreciated.

Thanks in advance,
Robert


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
     
    <script language="javascript" type="text/javascript">   
           
            function OpenWindow(name) 
            { 
                alert(name); 
                 
                var mgr =  $find('RadWindowManager1'); // GetRadWindowManager(); 
                 
                var wnd = mgr.open("http://www.google.com", null);          
                 
                return false; 
            }   
               
    </script> 
     
       
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
            <Windows> 
                <telerik:RadWindow ID="RadWindow1" runat="server"
                </telerik:RadWindow> 
            </Windows> 
        </telerik:RadWindowManager> 
         
        
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />       
        <asp:Label ID="InjectScript" runat="server" Text=""></asp:Label> 
 
    </form> 
</body> 
</html> 
 

protected void Button1_Click(object sender, EventArgs e) 
    { 
        InjectScript.Text = "<script type='text/javascript'>OpenWindow('RadWindowServicePopup')</script>"
    } 


7 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 05 Nov 2007, 09:48 AM
Hello Robert,

You need to make sure that the page will be fully loaded and the RadWindowManager is rendered on the page before you call the Javascript.
In ASP.NET AJAX environment this can be done by registering to the Sys.Application.load() event:


protected void Button1_Click(object sender, EventArgs e)    
{  
    InjectScript.Text = "<script type='text/javascript'>Sys.Application.add_load(function(){OpenWindow('RadWindowServicePopup')})</script>";    
      
}   






Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Joseph Roberts
Top achievements
Rank 1
answered on 28 Feb 2008, 02:12 PM
I'm having the same problem as stated above, but in my case I am creating a server control that will load a RadWindow.  The page the server controls is on has a RadWindowManager on it.  I can't get access to the RadWindowManager through script, it keeps coming up undefined.  I tried the suggestiong to use the Sys.Application.add_load, but now I'm getting an error that 'Sys' is undefined. 

Any ideas?
0
Joseph Roberts
Top achievements
Rank 1
answered on 28 Feb 2008, 02:18 PM
Solved my own problem.  Was trying to inject the script by RegistringClientScriptBlock.  That did not work, I just added the script to a label control added to the page. 
0
Peter Pyc
Top achievements
Rank 1
answered on 09 Dec 2009, 01:27 AM
Hi, Just want to say thanks.
This post fixed my problem.
I'm blown away by the level of support.
Keep it up.
Cheers
0
G W
Top achievements
Rank 1
answered on 06 Jan 2010, 11:52 PM
I had similar symptoms (everything was returning undefined or null) and came across this thread, but nothing was helping.

My problem was a really simple stupid one:  All the objects need to be inside the <form> tags (RadWindowManager, RadScriptManager, and any calls to Sys.Application.add_load()).  Other javascript can be outside of it, it seems, but not the Sys calls.

A previous developer who worked on this page that I am trying to convert to the ajax controls combined the page with the master page code, and what they ended up doing is putting all the master page code outside of the <form> tags.

Posting here to hopefully remind anyone of this possibility if they run into a poorly pieced together page like I did here.
0
kavitha
Top achievements
Rank 1
answered on 26 Nov 2010, 02:27 PM
Thank you GW. Putting all the objects  inside the <form> tags solved my problem.
Thank you very much for your solution.
0
Jasfer
Top achievements
Rank 1
answered on 11 Feb 2013, 12:48 PM
Hi ,

I had the same issue and javascript Sys.Application.add_load solved my problem..Thanks a lot.i been scratching my head for two days because of this problem finally solved ...thanks...
Tags
Window
Asked by
Robert
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Joseph Roberts
Top achievements
Rank 1
Peter Pyc
Top achievements
Rank 1
G W
Top achievements
Rank 1
kavitha
Top achievements
Rank 1
Jasfer
Top achievements
Rank 1
Share this question
or