Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReportViewer control returns blank page

I'm having problems with the standard ASP.NET ReportViewer control (v11, SQL 2012, VS 2012). This was previously working at some point, connecting to a remote SSRS server, but during the development of the site something's broken 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 this, nothing is displayed on the browser. Not even the This is a test! text, which would indicate to be that something is "crashing" on the server side. Backing up this theory, using Fiddler I can see there is no attempt to contact the report server.

I've turned on all exception trapping in Visual Studio, but nothing catches and there's nothing obvious that I can see in the output. The ReportViewer control displays correctly in Design mode, and I've reinstalled the ReportViewer redistributables.

like image 466
KenD Avatar asked Feb 16 '23 12:02

KenD


2 Answers

I've found the issue, or rather two issues:

  • I needed to have a ScriptManager on the page. Creating a completely new project with the above test webpage threw the error about the ScriptManager requirement, although a test page in the original project (and indeed, my original production page) didn't complain about the missing ScriptManager. I must have deleted the original ScriptManager by mistake. To fix it, all I needed to add was:

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

    ShowParameterPrompts="True"

    With this option defined, the page wouldn't load, giving the same error as above. However, removing that option allowed the page to load normally.

like image 92
KenD Avatar answered Mar 04 '23 02:03

KenD


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

Try to add this line:

rptv.ServerReport.Refresh();
like image 32
Mailo Avatar answered Mar 04 '23 02:03

Mailo