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

CompositeScript & Google jQuery

1 Answer 92 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
cglubish
Top achievements
Rank 2
cglubish asked on 15 Dec 2011, 03:37 PM
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">
         <Scripts>
             <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="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" /> 
</Scripts>
<CompositeScript>
<Scripts>               
             <asp:ScriptReference Path="/js/some.jquery.plugin.js" />
             <asp:ScriptReference Path="/js/another.jquery.plugin.js" />
         </Scripts>
</CompositeScript>
    </asp:ScriptManager>

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.

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 19 Dec 2011, 10:12 PM
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.

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
Tags
ScriptManager and StyleSheetManager
Asked by
cglubish
Top achievements
Rank 2
Answers by
Simon
Telerik team
Share this question
or