Explain to me load times between CompositeScript and Scripts.

4 posts, 1 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 01 Sep 2011 Link to this post

    Hi Telerik,

    I am struggling with an unrelated issue, but was exploring my options, and noted something quirky. I wanted to try executing a function on document ready. As such, I did this:

                $(document).ready(function () {
                    FixSplitter($find(rightPaneID));
                });

    with my script declarations as such:

    <telerik:RadScriptManager ID="ScriptManager1" Runat="Server" EnablePageMethods="True" >
        <CompositeScript>
            <Scripts>
                <asp:ScriptReference Path="~/Scripts/jquery-1.3.2.min.js" />
                <asp:ScriptReference Path="~/Scripts/jquery.json-2.2.min.js" />
                <asp:ScriptReference Path="~/Scripts/jquery-ui-1.7.2.custom.min.js" />
                <asp:ScriptReference Path="~/Scripts/Dashboard/Dashboard.js" />
                <asp:ScriptReference Path="~/Scripts/jquery.cookies.min.js" />
                <asp:ScriptReference Path="~/Scripts/jquery.hotkeys-0.7.9.js" />
                <asp:ScriptReference Path="~/Scripts/jquery.updnWatermark.js" />
                <asp:ScriptReference Path="~/Scripts/Master.js" />
            </Scripts>
        </CompositeScript>
        <Scripts>
            <asp:ScriptReference Name="Telerik.Web.UI.Common.Core.js" Assembly="Telerik.Web.UI"  />
        </Scripts>
    </telerik:RadScriptManager>

    I would like to keep my scripts combined. They should be combined. Loading scripts not combined is inefficient. Yet, when I have my jQuery scripts declared inside of CompositeScripts I am told 

    Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function

    If I move all my script declarations such that the declaration is like this:

    <telerik:RadScriptManager ID="ScriptManager1" Runat="Server" EnablePageMethods="True" >
        <CompositeScript>
            <Scripts>
            </Scripts>
        </CompositeScript>
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/jquery-1.3.2.min.js" />
            <asp:ScriptReference Path="~/Scripts/jquery.json-2.2.min.js" />
            <asp:ScriptReference Path="~/Scripts/jquery-ui-1.7.2.custom.min.js" />
            <asp:ScriptReference Path="~/Scripts/Dashboard/Dashboard.js" />
            <asp:ScriptReference Path="~/Scripts/jquery.cookies.min.js" />
            <asp:ScriptReference Path="~/Scripts/jquery.hotkeys-0.7.9.js" />
            <asp:ScriptReference Path="~/Scripts/jquery.updnWatermark.js" />
            <asp:ScriptReference Path="~/Scripts/Master.js" />
            <asp:ScriptReference Name="Telerik.Web.UI.Common.Core.js" Assembly="Telerik.Web.UI"  />
        </Scripts>
    </telerik:RadScriptManager>

    Presto! The error disappears. 

    Is there a good way to avoid this...? Could I have an explanation of what's going on so that I may fully understand the problem?

    Thanks.

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 13 Sep 2011 Link to this post

    Hi Sean,

    ScriptManager's CompositeScript is always output first, before the rest of the scripts referenced in the control. However, RadScriptManager seems to have a problem with that and it places the CompositeScript last. So, in your case, both setups should yield the same results - currently they do with SM and not with RSM.

    We will investigate further why RSM behaves in this way and will fix it as it's the default SM behavior. I updated your Telerik points for pointing us to the issue.

    Greetings,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 23 Sep 2011 Link to this post

    Hi Simon,

    Thanks for looking into this. Very interesting! I'll play around with it a bit more until I'm happy with the results. :)

    On another note, I didn't actually see any change to my Telerik points. I wasn't expecting anything when posting my original thread, so I'm not being pushy or anything, just thought a ball may have been unintentionally dropped.

    Sean
  5. Answer
    Simon
    Admin
    Simon avatar
    2281 posts

    Posted 27 Sep 2011 Link to this post

    Hello Sean,

    Your points were well deserved and this was a mistake on my side. Everything should be fine now.

    Please excuse me for my omission.

    Kind regards,
    Simon
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top