none
2010 ReportViewer Control Not Rendering in Internet Explorer When SizeToReportContent = False RRS feed

  • Question

  • Hello,

    I have spent most of the day browsing the internet looking for a solution but unfortunately it looks like this may be a relatively new problem.

    Ever since we updated our reporting web application to use the new 2010 ReportViewer we have not been able to get our reports to render in IE. We have tested this in IE 7 and IE 8. However we were able to get the reports to render in Firefox 4. We are using SQL Server 2008 RDL reports and Visual Studio 2010.

    I discovered today that if I make the SizeToReportContent property True instead of False our reports start to Render in IE. This ReportViewer control is inside an UpdatePanel but I do not think that should make a difference.

    The ReportViewer toolbar and parameters always show up correctly and function correctly. But after clicking the View Report button the only thing that changes is the Page Count label. The page count is always correct for the report but the report is never rendered in the control. Also I can click export report and the report exports perfectly fine without any issue. I have also viewed the report on the report server and it loads and runs without issue. I checked the error log in the database for the report server and it logs as a success every time.

    Please let me know if you need any more information.

    Thanks in advance!

     

     

    Monday, April 4, 2011 9:47 PM

All replies

  • Not sure what the problem is, but you should first check your Web.config file to see whether you're actually using the VS2010 ReportViewer, since you mentioned updating your web application. By simply upgrading a VS2008 app to VS2010 doesn't automatically update to the VS2010 viewer.

    Check if youre Web.config contains the following lines.

    <

     

    add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"

    />

    <

     

    add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"

    />

    ...

    <

     

     

    add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

    />

    ...

    <

     

     

    add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

    />

     

     

     

    Your ASP.NET page should also have the following line:

    <%

     

    @ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb"

    %>


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 5, 2011 5:17 PM
    Moderator
  • Thank you for taking a look. Unfortunately i do have all of the above information in my web.config and aspx pages.

    Also I have used sysinternals process monitor and verified that the web application is using the version 10.0.0.0 reportviewer assemblies.

     

    web.config:

     <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
          <assemblies>
            <add assembly="Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
          </assemblies>
          <buildProviders>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
          </buildProviders>
        </compilation>

    I also have the handlers in the web.config.

      <httpHandlers>
          <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
        </httpHandlers>
      </system.web>
      <!-- 
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <handlers>
          <add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
          <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </handlers>
      </system.webServer>
    </configuration>

     

    Aspx Page:

    <%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
    

     

    Please let me know if you have any other ideas. I appreciate all of the help!

    Tuesday, April 5, 2011 8:39 PM
  • I should've mentioned that it would be helpful to see your custom XML in the ASPX page and your codebehind to identify the problem.


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 5, 2011 8:43 PM
    Moderator
  • Sure

     

    This is where the ReportViewer control is declared:

        <form id="form1" runat="server" >
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
                <rsweb:ReportViewer runat="server" ID="ReportViewer1" 
                    ProcessingMode="Remote" ZoomMode="PageWidth" ShowCredentialPrompts="False"
                    BorderStyle="Solid" Height="100%" BorderWidth="0" Width="100%"  ShowBackButton="True"
                    Style="display:table;" AsyncRendering="true">
                </rsweb:ReportViewer>
    

    In the code behind I set the report path and these settings:

        Public Sub PageSettings(ByVal showParams As Boolean)
            ReportViewer1.Focus()
            ReportViewer1.ShowBackButton = True
            ReportViewer1.ShowPromptAreaButton = True
            ReportViewer1.AsyncRendering = True
            ReportViewer1.SizeToReportContent = False
     
     
     
            ReportViewer1.BackColor = Drawing.Color.LightGray
            ReportViewer1.ZoomMode = ZoomMode.Percent
            ReportViewer1.ZoomPercent = 100
     
     
            If showParams Then
                ReportViewer1.ShowParameterPrompts = True
            Else
                ReportViewer1.ShowParameterPrompts = False
            End If
        End Sub

    Only on the first page load though, I do not set anything on post backs.

    When I change   ReportViewer1.SizeToReportContent = False to True everything works. Unfortunately I need it to be set to False for this application.

    Tuesday, April 5, 2011 9:17 PM
  • How do you ensure that you're not setting anything on post backs? Where are you calling PageSettings? SizeToReportContent=False is the default value for ReportViewer and it's supposed to work. It would be a lame product if the default settings don't work by design. ;)
    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 5, 2011 9:22 PM
    Moderator
  • In the PageLoad I do a check where Not Page.IsPostBack:

     Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgsHandles Me.Load
            If Not Page.IsPostBack Then
                Dim showParams As Boolean = True
                Dim ReportServerURL As String = ""
                Dim reportFolder As String = ""
                Dim report As String = ""
                Dim order As String = ""
                Dim common As Common = New Common
                Dim reportPath As SqlDataReader = Nothing
                Dim parameters() As Microsoft.Reporting.WebForms.ReportParameter
     
                If Not Request.Params("report"Is Nothing Then
                    report = Request.QueryString("report").ToString()
                Else
                    report = ClientQueryString.ToString
                    report = report.Substring(report.IndexOf("=") + 1)
                End If
     
                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
                reportFolder = common.GetReportFolder(common.GetConnectionString())
                reportPath = common.GetReportPath(common.GetConnectionString(), report)
     
                'Set URI of report path once the folder URL is determined.
                If Not reportPath Is Nothing Then
                    If reportPath.Read Then
                        common.GetCustomReportFolder(reportFolder, reportPath.Item(0))
                        ReportViewer1.ServerReport.ReportPath = reportFolder & reportPath.Item(0).ToString
                        showParams = reportPath.Item(1).ToString
                    End If
                End If
     
                If Request.QueryString.Count > 1 Then
                    parameters = GetReportParameters()
                    ReportViewer1.ServerReport.SetParameters(parameters)
                End If
                PageSettings(showParams)
     
                ReportViewer1.ServerReport.Refresh()
     
     
            End If
    Tuesday, April 5, 2011 9:25 PM
  • Where in your code do you set the report server URL? It's not found in any of your code above. I assume it's after the If clause so I created a test application using your ASPX snippet and your code snippet you included so far with the following simplified Page_Load, pointing to a report that doesn't need parameters. The report renders just fine in IE8.

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me

    .Load

     

    If Not Page.IsPostBack

    Then

     

    Dim showParams As Boolean =

    True

     

    Dim ReportServerURL As String =

    ""

     

    Dim reportFolder As String =

    ""

     

    Dim report As String =

    ""

     

    Dim order As String =

    ""

     

    If Not Request.Params("report") Is Nothing

    Then

    report = Request.QueryString(

    "report"

    ).ToString()

     

    Else

    report = ClientQueryString.ToString

    report = report.Substring(report.IndexOf(

    "="

    ) + 1)

     

    End

    If

    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.

    ProcessingMode

    .Remote

    ReportViewer1.ServerReport.ReportPath =

    "/AdventureWorks2008 Sample Reports/Product Catalog 2008"

    PageSettings(showParams)

    ReportViewer1.ServerReport.Refresh()

     

     

    End

    If

    ReportViewer1.ServerReport.ReportServerUrl =

    New Uri(https://myreportserver/reportserver

    )

     

    End

    Sub


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 5, 2011 10:23 PM
    Moderator
  • Sorry I accidently removed that line from the pageload when I pasted it in here.

     

      Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgsHandles Me.Load
            If Not Page.IsPostBack Then
                Dim showParams As Boolean = True
                Dim ReportServerURL As String = ""
                Dim reportFolder As String = ""
                Dim report As String = ""
                Dim order As String = ""
                Dim common As Common = New Common
                Dim reportPath As SqlDataReader = Nothing
                Dim parameters() As Microsoft.Reporting.WebForms.ReportParameter
     
                If Not Request.Params("report"Is Nothing Then
                    report = Request.QueryString("report").ToString()
                Else
                    report = ClientQueryString.ToString
                    report = report.Substring(report.IndexOf("=") + 1)
                End If
     
                ReportViewer1.ServerReport.ReportServerUrl = New Uri(common.GetReportServerPath(common.GetConnectionString()))
     
                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
                reportFolder = common.GetReportFolder(common.GetConnectionString())
                reportPath = common.GetReportPath(common.GetConnectionString(), report)
     
                'Set URI of report path once the folder URL is determined.
                If Not reportPath Is Nothing Then
                    If reportPath.Read Then
                        common.GetCustomReportFolder(reportFolder, reportPath.Item(0))
                        ReportViewer1.ServerReport.ReportPath = reportFolder & reportPath.Item(0).ToString
                        showParams = reportPath.Item(1).ToString
                    End If
                End If
     
                If Request.QueryString.Count > 1 Then
                    parameters = GetReportParameters()
                    ReportViewer1.ServerReport.SetParameters(parameters)
                End If
                PageSettings(showParams)
                ReportViewer1.ServerReport.Refresh()
            End If
        End Sub

     

    This is so strange because it will render fine in Firefox 4 but not IE 7 or IE 8.

    Wednesday, April 6, 2011 1:59 PM
  • At this point, I suggest creating a new test application in VS2010 using the simplified code I used, with your ASPX code (in short try to do the same as what I did) and see if you can get it to render in IE8.

    If yes, then I would say it's some other code in your app that's messing things up and you're only seeing the side effect of that in SizeToReportContent.

    If no, then I would check if you have any special settings in IE8 that prevents the report from being properly shown (custom security, etc).


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Wednesday, April 6, 2011 3:54 PM
    Moderator
  • I too was having this problem today where IE7 was not displaying the report in the reportviewer control but it works fine in FireFox.

     

    I finally worked out why it was happening. I'd forgotten I was forcing IE7 into Quirks mode. It seems that if IE7 is in Quirks Mode, then the report doesn't display.

    By not putting IE7 into quirks mode, the report miraculously appeared. I suspect that might be what is causing your problem too.

    Friday, May 20, 2011 2:51 PM
  • That was exactly the same with me on IE11! In Chrome everything has displayed properly.

    I comes up with adding  <meta http-equiv="X-UA-Compatible" content="IE=edge"/> page header with ReportViewer control:

    <head>
         <title>page</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    </head>

    UPDATE: with "IE=edge" there is no possibilities to print report, so I change it to "IE=9":

    <head>
         <title>page</title>
        <meta http-equiv="X-UA-Compatible" content="IE=9"/>
    </head>

    Wednesday, July 16, 2014 1:57 PM