RadScriptManager (.NET 4.5) incompatible with AspNet.ScriptManager.jQuery

3 posts, 1 answers
  1. Igor
    Igor avatar
    24 posts
    Member since:
    May 2013

    Posted 02 Oct 2014 Link to this post

    Hello, I recently upgraded my Telerik project from .NET 4.0 to 4.5.1.
    I' m having a lot of issues with jQuery.
    Basically the following piece of markup 

        <telerik:RadScriptManager ID="_scriptManager" runat="server">
            <Scripts>
                <asp:ScriptReference Name="jquery" />
            </Scripts>
        </telerik:RadScriptManager>

    in .NET 4.0 renders the jquery include, but in .NET 4.5 renders nothing, no jquery.

    The only workaround I fond is to use the embedded Telerik jQuery.

        <telerik:RadScriptManager ID="_scriptManager" runat="server">
        </telerik:RadScriptManager>
        <script type="text/javascript">
            window.jQuery = window.$ = $telerik.$;
        </script>

  2. Igor
    Igor avatar
    24 posts
    Member since:
    May 2013

    Posted 02 Oct 2014 Link to this post

    Sorry, this is the correct workaround

        <telerik:RadScriptManager ID="_scriptManager" 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" />  
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script type="text/javascript">
            window.jQuery = window.$ = $telerik.$;
        </script>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Slav
    Admin
    Slav avatar
    1355 posts

    Posted 06 Oct 2014 Link to this post

    Hi Igor,

    Indeed, the jquery mapping that is added with the AspNet.ScriptManager.jQuery package is cleared by the RadScriptManager on the page in .NET 4.5 projects.

    We will post a help article with information about handling such scenarios. Until it is live you can also try installing the following package - https://www.nuget.org/packages/Microsoft.AspNet.ScriptManager.WebForms, then configuring RadScriptManager as shown below:
    <telerik:RadScriptManager ID="_scriptManager" runat="server" EnableEmbeddedjQuery="false">
        <Scripts>
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
        </Scripts>
    </telerik:RadScriptManager>

    This should allow you to use the version of jQuery that comes with AspNet.ScriptManager.jQuery, however the same version will be used by the Telerik controls as well. If the version of the external jQuery is different than the one that is included in the Telerik controls you may run into problems with their functionality.

    Regards,
    Slav
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top