Sys.Application is undefined

2 posts, 0 answers
  1. Bill TenBroeck
    Bill TenBroeck avatar
    5 posts
    Member since:
    Jul 2004

    Posted 31 Jul 2008 Link to this post

    Hello -

    I have a mapping application (the get map calls are AJAX based), and the page is a full screen splitter layout (5 panes, I believe). I need to know the size of the map pane so I can include the height and width with the AJAX call for the Map. In the older 2006 Telerik version, I basically had to create a hack where I attached a javascript function the topSplitter_onLoaded event, to check to see if the Map pane was created yet. If it wasn't, I waited 500 ms, and tried again. This worked well.

    Withe the new version 2008 q2, I'm now getting the sys.application is undefined error. I'm assuming this has to do with something being referenced before it is created.

    The following is the code (from Firebug) that is failing:

    Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadPane, {"_collapsed":true,"_collapsedDirection":1,"_expandedSize":0,"_height":"400px","_index":0,"_indexInPanes":0,"_originalHeight":"400px","_originalWidth":"220px","_scrollLeft":0,"_scrollTop":0,"_width":"220px","clientStateFieldID":"navPanel_ClientState"}, null, {"parent":"topSplitter","splitter":"topSplitter"}, $get("navPanel"));
    });


    I saw the following in a related post, but I am unsure how it helps:

    That is why when you try to obtain a reference to the RadWindowManager its client object is still not created. To correctly reference it you should add a load handler as shown below:
    literalInjectJavascript.Text = "<script type='text/javascript'> Sys.Application.add_load(ShowWindow); </script>";

  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 04 Aug 2008 Link to this post

    Hi Bill TenBroeck,
    I just answered your support ticket with the same question, but I will give the information here as well, so that it is available to all, who might run into the same problem:

    ***
    Although I am not sure what the problem is, I believe it is different than the one with the RadWindowManager. The problem with the manager was connected to the fact that the client tried to reference the manager client object in the window.onload handler, where it was not created yet. In your case however, the line that fails is the creating of the client object. It is handled by the RadSplitter control itself and it takes place exactly when intended.

    What could have happened is that the necessary js files are not loaded - please check whether your project is configured correctly as described in our online documentation:
    1. General ASP.NET AJAX Info
    2. Adding RadControls for ASP.NET AJAX to an existing application
    3. Troubleshooting
    In case this does not help, please prepare and send us a simple running project, demonstrating the problem, so that we can investigate locally what is causing the described result.
    ***

    Sincerely yours,
    Tsvetie
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top