What to do about "window.$RSjQuery is not a function" in Reserved.ReportViewerWebControl.axd
I inherited an ASP.NET Web Forms project that uses RDLC. It was using the Microsoft.ReportViewer 11.0.3366.16 NuGet package and my task has been to upgrade it to the Microsoft.ReportingServices.ReportViewerControl.WebForms 150.1652.0 NuGet. By following the instructions at https://stackoverflow.com/questions/71328504/how-do-i-fix-the-report-viewer-error-in-visual-studio-2019/72790325#72790325, I managed to achieve clean RDLC upgrades and a clean build, but actually running the app and pulling up a report fails. The browser developer tools console shows the following error message:
Uncaught TypeError: window.$RSjQuery is not a function
at Microsoft.Reporting.WebFormsClient._Toolbar.ConnectEventHandlers (Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=15.0.1652.0&Name=ViewerScript:5793:20)
at Microsoft.Reporting.WebFormsClient._Toolbar.EnableDisable (Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=15.0.1652.0&Name=ViewerScript:5829:22)
at Microsoft.Reporting.WebFormsClient._Toolbar.OnReportViewerLoadingChanged (Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=15.0.1652.0&Name=ViewerScript:5807:18)
at Array.<anonymous> (ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQu_QkkuHALosGRSE3q2eqYTsG3OkfiKJs8pai6QeupRVou7kwRdmwTgWKemPrCff37ZwX0hSX1ocdHSNh-liYRKhLO94ps9h6Gc_qQBFOjvOMR1o2v7zkfxVITYz8H_NNeto-8LASg8Y21VlLJGdBoI1&t=ffffffffd5352e16:47:23)
at ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQu_QkkuHALosGRSE3q2eqYTsG3OkfiKJs8pai6QeupRVou7kwRdmwTgWKemPrCff37ZwX0hSX1ocdHSNh-liYRKhLO94ps9h6Gc_qQBFOjvOMR1o2v7zkfxVITYz8H_NNeto-8LASg8Y21VlLJGdBoI1&t=ffffffffd5352e16:3484:23
at Microsoft.Reporting.WebFormsClient.ReportViewer.Sys$Component$raisePropertyChanged [as raisePropertyChanged] (ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQu_QkkuHALosGRSE3q2eqYTsG3OkfiKJs8pai6QeupRVou7kwRdmwTgWKemPrCff37ZwX0hSX1ocdHSNh-liYRKhLO94ps9h6Gc_qQBFOjvOMR1o2v7zkfxVITYz8H_NNeto-8LASg8Y21VlLJGdBoI1&t=ffffffffd5352e16:3701:13)
at Microsoft.Reporting.WebFormsClient.ReportViewer._onInternalViewerLoading (Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=15.0.1652.0&Name=ViewerScript:6510:18)
at Array.<anonymous> (ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQu_QkkuHALosGRSE3q2eqYTsG3OkfiKJs8pai6QeupRVou7kwRdmwTgWKemPrCff37ZwX0hSX1ocdHSNh-liYRKhLO94ps9h6Gc_qQBFOjvOMR1o2v7zkfxVITYz8H_NNeto-8LASg8Y21VlLJGdBoI1&t=ffffffffd5352e16:47:23)
at ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQu_QkkuHALosGRSE3q2eqYTsG3OkfiKJs8pai6QeupRVou7kwRdmwTgWKemPrCff37ZwX0hSX1ocdHSNh-liYRKhLO94ps9h6Gc_qQBFOjvOMR1o2v7zkfxVITYz8H_NNeto-8LASg8Y21VlLJGdBoI1&t=ffffffffd5352e16:3484:23
at Microsoft.Reporting.WebFormsClient._InternalReportViewer.Sys$Component$raisePropertyChanged [as raisePropertyChanged] (ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQu_QkkuHALosGRSE3q2eqYTsG3OkfiKJs8pai6QeupRVou7kwRdmwTgWKemPrCff37ZwX0hSX1ocdHSNh-liYRKhLO94ps9h6Gc_qQBFOjvOMR1o2v7zkfxVITYz8H_NNeto-8LASg8Y21VlLJGdBoI1&t=ffffffffd5352e16:3701:13)
The offending code in Reserved.ReportViewerWebControl.axd seems to be:
`// Setup responsive toolbar layout`
var self = this;
if ($) {
window.$RSjQuery(window).on("resize", function () {
window.setTimeout(function() {
self.ResizeToolbarIcons();
}, 100);
});
}
The way the "$" variable is defined earlier in that AXD script, it could indicate that either window.$RSjQuery
or window.$
are defined. In my case the former is obviously not true.
I suspect this is either a bug in Reserved.ReportViewerWebControl.axd or there's something wrong with my configuration.
Is there any way I can overcome this, or does Reserved.ReportViewerWebControl.axd need to be corrected?