HowTo Disable Built-In jQuery

16 posts, 0 answers
  1. Wouter Born
    Wouter Born avatar
    8 posts
    Member since:
    Jan 2008

    Posted 09 Jun 2011 Link to this post

    We are making use of jQuery in our solutions and currently load jQuery 1.6 in our solution. We also would like to define our own jQuery functions, but we've encountered the problem that the Telerik libraries load its own version of jQuery (with our current version jQuery 1.4.2 is loaded) which the version would not be a problem, but ALL of our custom jQuery functions get override after Telerik loads the library.

    I've seen the "directive" to disable the loading of Telerik's built-in jQuery for MVC, but we are using the standard ASP.NET model and thus the Telerik AJAX controls.

    How can we disable this Telerik built-in jQuery library????

    Thanks
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 13 Jun 2011 Link to this post

    Hi Wouter,

    Try including your jQuery scripts at the end of the form (before the closing </form> tag) - it needs to be placed after the RadControls' declarations.
    In addition, depending on your scenario, you could use jQuery's noConflict() method.

    I hope this helps.

    Best wishes,
    Georgi Tunev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ed
    Ed avatar
    24 posts
    Member since:
    May 2005

    Posted 14 Oct 2011 Link to this post

    Hi,

    Sorry for replying to an old post but this has now become an issue for us also.

    We are using JQuery in our projects already which we load in the document <head>.

    Now we are using the Telerik tools and RadScriptManger, we don't want it to also include JQuery as it is already loaded on the page and seems a waste of bandwidth.

    So we just need a simple way to disable the loading of the Telerik JQuery include (like there appears to be for your MVC controls). Does such a thing exist and if not can you add it please.

    Thanks,
    Andy
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 21 Oct 2011 Link to this post

    Hello Andy C,

    You can override our jQuery with yours so that only one loads on the page. You can do this by adding the following two script references to your ScriptManager:
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
       <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="[path_to_your_jquery.js]" />
       </Scripts>
    </telerik:RadScriptManager>

    I hope this helps.

    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
  6. Ed
    Ed avatar
    24 posts
    Member since:
    May 2005

    Posted 21 Oct 2011 Link to this post

    Hi Simon,
    Thanks for the reply.

    Ideally what I'd like to do is to be able to load my version of JQuery in the <head> of the page and not use the radscriptmanager to load it. So I guess I would need some kind of switch to tell the radscriptmanager that jquery is already loaded and available on the page, just go with it.

    Or alternatively, have the radscriptmanger put the version that it loads in the <head>. It is just that I don't like it loading it in the <body>.

    Does that make sense?

    Thanks,
    Andy
  7. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 23 Oct 2011 Link to this post

    Hello Andy C,

    Yes, it makes a lot of sense. The bad thing is that RadScriptManager inherits from ScriptManager and the latter puts all scripts in the <body>. If we ever undertake the task of either altering this behavior or allowing the option to move certain scripts in the <head>, as you suggest, it will mean a solid rewrite of the current code and will require lots of testing.

    So, currently this is not in our immediate plans but we will have it mind for future versions.

    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
  8. Ed
    Ed avatar
    24 posts
    Member since:
    May 2005

    Posted 24 Oct 2011 Link to this post

    Hi Simon,

    Please correct me if I am wrong but isn't it the RadScriptManager that includes jQuery and not the ScriptManager?
    Doesn't this mean you could just add a option not to include jQuery and take it for granted that it has already been loaded?
    I apologise in advance if I am mistaken about the ScriptManager.

    Cheers,
    Andy
  9. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 24 Oct 2011 Link to this post

    Hi Andy C,

    Yes, RadScriptManager adds a reference to jQuery to all scripts to be output, however, the base code in ScriptManager renders links to registered script references in the <body>.

    So, an alternative way to work around this and achieve your requirement is to override our jQuery with a path to an empty script file. This way you could put your jQuery to the <head> and not load ours. I hope this is an acceptable 'solution'.

    All the best,
    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
  10. Ed
    Ed avatar
    24 posts
    Member since:
    May 2005

    Posted 24 Oct 2011 Link to this post

    Thanks Simon,

    Your workaround would work but it would still have the browser request an empty script file, which would be an unneeded request.

    Would it not be possible for you to add an option to the RadScriptManager to just not add the jQuery script reference?

    Cheers,
    Andy
  11. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 26 Oct 2011 Link to this post

    Hello Andy,

    You are right - there will be one more additional request in this way. An alternative approach would be to embedded this empty JS file into an assembly - this way RadScriptManager will be able combine all requests into one. (If the file is not embedded you will get three requests with script combining on.)

    As for the property we will consider its implementation in the near future.

    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
  12. Rob
    Rob avatar
    43 posts
    Member since:
    Aug 2010

    Posted 06 Dec 2011 Link to this post

    Has there been any advance with this?  I've been trying to use some jQuery plugins today only to find they get overwritten when the Telerik version of jQuery loads.  We'd like to keep the jQuery in the head as this is an old project and various inline scripts and other pages have been written with the assumption that jQuery is available, so just having Telerik use the already loaded jQuery would be much simpler.

    Rob

    PS.  I've found that pointing the Telerik.Web.UI.Common.jQuery.js ScriptReference to an empty file by itself doesn't work, you need to set the telerik.$ variable in that file:

    $telerik.$ = window.$;
  13. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 12 Dec 2011 Link to this post

    Hi Rob,

    You need to include one additional file from our assembly to make this work. Please see this help article for more info.

    Greetings,
    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
  14. Rob
    Rob avatar
    43 posts
    Member since:
    Aug 2010

    Posted 12 Dec 2011 Link to this post

    Hi Simon

    It's not clear to me how that article helps?  First of all, it's impossible to add two RadScriptManagers in the same page; secondly that looks like I'd still end up with the built in jQuery overriding the one already included on the page.

    Rob
  15. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 12 Dec 2011 Link to this post

    Hi Rob,

    The help article suggests that you can use our built-in jQuery with a jQuery plugin without the need to include another jQuery. Yes, you will use our jQuery, however, the configuration is straightforward and I thought you may find it useful. If you want to stick with your version of jQuery, then the workaround you have found would suffice.

    As for the two RadScriptManagers, you only need one. The help article shows both ways - when you have a RadControl on the page (the second RSM) and when you do not have (the first RSM; you need to also add the jQueryInclude.js after the first two script references).

    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
  16. Rob
    Rob avatar
    43 posts
    Member since:
    Aug 2010

    Posted 13 Dec 2011 Link to this post

    Hi

    I don't really get that from the article, you may want to consider updating it.  It says "These are the steps...", then there are two numbered steps, and both steps involve adding a script manager.

    We need to have the jQuery loaded in the head because we have a large collection of legacy pages which have inline JS in the head elements which depends on jQuery (at least until we have time to update/replace them); loading it again in the script manager is just wasteful.

    Rob
  17. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 15 Dec 2011 Link to this post

    Hi Rob,

    Indeed, the help article is a bit confusing, it will be better if the two approaches were shown with their full code independently. We will fix this.

    As for the real problem - were are aware of it and will provide the ability to disable our jQuery in the next version of Telerik.Web.UI based on all of the feedback on the subject.

    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
UI for ASP.NET Ajax is Ready for VS 2017