RadScriptManager and SignalR not playing nice with each other

1 Answer 170 Views
ScriptManager and StyleSheetManager
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
SSirica asked on 14 Jun 2022, 02:32 PM | edited on 14 Jun 2022, 02:32 PM

I have a master page with the following code:

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="True" EnableCdn="True" EnablePartialRendering="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" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>

My SignalR Javascript code:

<!--Script references. --> <!--Reference the jQuery library. --> <script src="Scripts/jquery-3.6.0.min.js"></script> <!--Reference the SignalR library. --> <script src="Scripts/jquery.signalR-2.4.3.min.js"></script> <!--Reference the autogenerated SignalR hub script. --> <script src="signalr/hubs"></script><telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> $(function () { // Declare a proxy to reference the hub.

// Error Line var hub = $.connection.progressHub; // Create a function that the hub can call to report progress. hub.client.receiveMessge = function (Item) { $('#<%=lblCurrRec.ClientID%>').html(Item.SITE_CODE); $('#<%=lblStat.ClientID%>').html(Item.STATUS); $('#<%=lblRes.ClientID%>').html(Item.MESSAGE); }; hub.client.UpdateTotal = function (iTotal, iSent, iNotSent) { $('#<%=lblTotal.ClientID%>').html(iTotal); $('#<%=lblRecsProc.ClientID%>').html(iSent); $('#<%=lblErrorRecs.ClientID%>').html(iNotSent); }; $.connection.hub.start(); }); </script> </telerik:RadScriptBlock>

When I run the code I get the following error:

 Cannot read properties of undefined (reading 'progressHub')

If I put all this in it's own test page and replace the RadScriptManager with the following it works flawlessly:

<asp:ScriptManager ID="MainScriptManager" runat="server" EnablePartialRendering="true" EnablePageMethods="true" AsyncPostBackTimeout="600" />
The problem is...other stuff breaks if I don't use the RadScriptManager.  It has something to do with the Telerik.Web.UI.Common.jQuery

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 14 Jun 2022, 03:23 PM

Hi Steve,

It seems like the two jQuery versions are conflicting due to the .Include.js script you add:

If you load an external jQuery, you don't need to add the Telerik.Web.UI.Common.jQueryInclude.js. The purpose of the Telerik.Web.UI.Common.jQueryInclude.js script is to expose the embedded jQuery as publicly accessible via the window.$ global variable. 

Try to remove the jQuery include script as below and see if that would resolve the issue:

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="True" EnableCdn="True" EnablePartialRendering="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" />
            </Scripts>
        </telerik:RadScriptManager>

Regards,
Peter Milchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

SSirica
Top achievements
Rank 3
Iron
Iron
Iron
commented on 14 Jun 2022, 05:36 PM

Thanks, but that didn't work.  I ended up making the process be contained in a popup window and used the code that works.  
Tags
ScriptManager and StyleSheetManager
Asked by
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Peter Milchev
Telerik team
Share this question
or