CompositeScript & Google jQuery

2 posts, 0 answers
  1. cglubish
    cglubish avatar
    11 posts
    Member since:
    Aug 2012

    Posted 15 Dec 2011 Link to this post

    I am wondering if someone could provide some insight and direction....  For performance reasons I am trying to use a composite script & I am wanting to point my users to use Google's jQuery version so my end users don't have to download it again.

    I followed your instructions to make RadControls use an external jQuery.  I then tried to 'compositescript' the rest of my external JS references.  As folows:

        <asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true">
                 <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />  
                 <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" Path="" />
    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" /> 
                 <asp:ScriptReference Path="/js/some.jquery.plugin.js" />
                 <asp:ScriptReference Path="/js/another.jquery.plugin.js" />

    This fails, because SM renders the compositeScript first which means jQuery isn't loaded yet and the plugins fail.  I can't figure out any way around this....

    Is there a solution?? Or do you have other tips to make this run better.  I don't have RadControls on every page of this website, but do use jQuery on every page.  I am keen on the compositeScript because I have many many plugins and UI files.  For now I'm resorting to manually combining and minifying.

    Any workaround, tips or suggestions on how to tune this the best would be appreciated.

  2. Simon
    Simon avatar
    2281 posts

    Posted 19 Dec 2011 Link to this post

    Hello Mr,

    Indeed, this is how ScriptManager works: it puts the CompositeScript immediately after MicrosoftAjaxWebForms.js.

    We are currently working on a feature that will allow disabling our jQuery (with a property of RadScriptManager) without having to do the trick you are using now, so jQuery can be included explicitly (e.g. in the <head>).Then the problem in your case will be resolved.

    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