ReportViewer Control Returns Blank Page

I'm having problems with the standard ASP.NET ReportViewer control (v11, SQL 2012, VS 2012). Previously, this worked by connecting to a remote SSRS server, but during site development, something broke it, and I'm struggling to isolate the cause.

If I create a simple form:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReportTest.aspx.cs" Inherits="ReportTest" %> <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> This is a test! <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote"> <ServerReport ReportPath="/Reports/MyTestReport" ReportServerUrl="http://sqlserver/reportserver" /> </rsweb:ReportViewer> </div> </form> </body> </html> 

.. and run it, nothing is displayed in the browser. Even the text This is a test! , which indicates that something is "crashing" on the server side. Backing up this theory using Fiddler, I see that there is no attempt to contact the report server.

I have included all exceptions in Visual Studio, but it catches nothing, and there is nothing obvious that I can see in the output. The ReportViewer control displays correctly in design mode, and I reinstalled the ReportViewer redistributable components.

+4
source share
4 answers

I found a problem, or rather, two problems:

  • I needed to create a ScriptManager on the page. Creating a completely new project with the above test web page caused an error in the ScriptManager request, although the test page in the original project (and indeed my original page) did not complain about the missing ScriptManager. I had to remove the original ScriptManager by mistake. To fix this, all I needed to add was:

     <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
  • Secondly - and that was in the production code itself - I had a parameter

    ShowParameterPrompts="True"

    If this option is specified, the page will not load, indicating the same error as above. However, removing this option allows the page to load normally.

+3
source

I think I had something like that. I fixed this when I added the code behind to Page_Init instead of Page_Load.

Try adding this line:

 rptv.ServerReport.Refresh(); 
+2
source

this.ReportViewer1.AsyncRendering = false;

it made my page work.

+1
source

If you are sending a parameter that can take null values, you must specify this in the ReportViever accept null argument. It does not detect that I am showing an empty report without any errors.

0
source

Source: https://habr.com/ru/post/1481362/


All Articles