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

3 posts, 0 answers
  1. yao wang
    yao wang avatar
    25 posts
    Member since:
    May 2010

    Posted 23 May 2010 Link to this post

    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. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 25 May 2010 Link to this post

    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.
  3. yao wang
    yao wang avatar
    25 posts
    Member since:
    May 2010

    Posted 25 May 2010 Link to this post

    Thanks a lot, which makes me understand clearly.
Back to Top