I have been asked to upgrade a 10-years-old ASP.Net 2.0 web application project to the latest .Net framework and Visual Studio solution. The project must display a series of SQL Server Reporting services reports via the ReportViewer web control.
So, I have upgraded the project to use .Net Framework 4.6.1 and I am developing with Visual Studio 2017. I also upgraded the ReportViewer control to the latest available version.
and this is the offending code, that is generated by the ReportViewer control itself
The problem is that Sys.Application does not contain an add_init method.
The page containing the ReportViewer control is quite simple:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Width="100%" Height="95%" ProcessingMode="Remote" ShowCredentialPrompts="False" SizeToReportContent="True" style="overflow: auto;" > </rsweb:ReportViewer> </asp:Content>
That's all; the mandatory ScriptManager required by the ReportViewer control is laid on the site master page.
WHAT I TRIED SO FAR
I spent an entire day googling this error, finding several questions, but none related to my problem: in all thast cases it turned out it was a mistake in user code; in my case, this is code generated automatically by the web control. In most cases it were either the Sys or the Application object NUL; in my case Sys.Application is not null: it simply does not contain an $add_init method (or any other method, for that).
Anyway, I tried to follow some suggestions I found in other questions, to no avail.
I also tried creating a new simple test application, that only display a report on a page: it works perfectly.
I compared the test appllication web.config with the one from my app: there were differences, that I removed; again, no luck.
I also tried to use the web.config from the test application, adding only the items strictly needed to start the program, and going directly to the report page: the error is still here.
Anyone can help me getting this report page working? If more infos/data/code snippets are needed, just ask.
Thanks in advance,
After a lot more investigations, I found that ComponentArt web controls are conflicting with .Net built-in AJAX infrastructure.
Since ComponentArt is discontinued, I would have to replace these controls with something else on every page; something I am not allowed to do for time and budget reasons.
So I ended up building a simple, totally white page conaining the ReportViewer control only, and displaying it in an Iframe placed on the original report viewer page.
Dirty, but it works. Maybe in the future there will be some budget to buy new controls and to remove those obsolete ones.
Hope this will help someone else.
User contributions licensed under CC BY-SA 3.0