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

'telerik.web.ui.windowBehahaviors.close' is null or not an object.

2 Answers 161 Views
Window
This is a migrated thread and some comments may be shown as answers.
yao wang
Top achievements
Rank 1
yao wang asked on 23 May 2010, 06:10 AM

In main page which contains the radwindowmanager, I added an radwindow "G" under the radwindowmanager. After I opened the radwindow "G", I tried to open another radwindow "C" from radwindow "G" by using the code below.

function openWindow(Url, Id) {

            var oMan = GetWindowManager();

            var oWnd = oMan.open(Url, Id);

            oWnd.set_visibleStatusbar(false);

            oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize);

            //something wrong here

            oWnd.setActive();

            return oWnd;

}

however I got the error message below 
'telerik.web.ui.windowBehahaviors.close' is null or not an object.

 in web.config, I added 

<location path="Telerik.Web.UI.WebResource.axd">

    <system.web>

      <authorization>

        <allow users="*" />

      </authorization>

    </system.web>

  </location>

 
please advise what cause this issue? Thanks.

2 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 25 May 2010, 03:13 PM
Hi,

You should get a reference to the parent page(where the RadWindowManager is) and use parentPage.Telerik.Web.UI.WindowBehaviors.Close instead of
Telerik.Web.UI.WindowBehaviors.Close .
I created for you a simple example, which illustrates how to open a RadWindow from a button which is inside another RadWindow.
Default.aspx
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Windows>
                <telerik:RadWindow ID="RadWindow1" NavigateUrl="ContentWindow.aspx" VisibleOnPageLoad="true"></telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </div>
    </form>
</body>
</html>
ContentWindow.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <script type="text/javascript">
        function openWindow(Url, Id)
        {
            var parentPage = GetRadWindow().BrowserWindow;
            var oMan = parentPage.GetRadWindowManager();
            var oWnd = oMan.open(Url, Id);
            oWnd.set_visibleStatusbar(false);
              
            oWnd.set_behaviors(parentPage.Telerik.Web.UI.WindowBehaviors.Close + parentPage.Telerik.Web.UI.WindowBehaviors.Move + parentPage.Telerik.Web.UI.WindowBehaviors.Resize);
              
            window.setTimeout(function ()
            {
                oWnd.setActive(true);
            }, 0);
            
            return oWnd;
        }
  
        function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }
  
    </script>
    <div>
        <input type="button" onclick="openWindow('http://www.google.com','RadWindow2');return false;" value="ShowWindow In ParentPage"/>
    </div>
    </form>
</body>
</html>
Hope this helps.


All the best,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
yao wang
Top achievements
Rank 1
answered on 25 May 2010, 03:26 PM
Thanks a lot, which makes me understand clearly.
Tags
Window
Asked by
yao wang
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
yao wang
Top achievements
Rank 1
Share this question
or