locked
Resize report viewer iframe RRS feed

  • Question

  • My report is displayed in the iframe, but the iframe is tiny. I am receiving an error 'uncaught type error' 'cannot read property 'height' of null at resize iframe'. I need the viewer to autosize to the size of report that is being displayed.

    @using ReportViewerForMvc;
    <div id="gsdResults2" width="100%" height="100%">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)</div>

    ReportViewerWebForm.aspx

    <%@ 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 style="margin: 0px; padding: 0px;">
        <form id="form1" runat="server">
            <div>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                    <Scripts>
                        <asp:ScriptReference Assembly="ReportViewerForMvc" Name="ReportViewerForMvc.Scripts.PostMessage.js" />
                    </Scripts>
                </asp:ScriptManager>
                <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%" BackColor="#FFFBF7" ZoomMode="FullPage"
                                    BorderWidth="0px" ShowFindControls="False" Height="100%" ShowBackButton="True"
                                    ProcessingMode="Remote" ShowPromptAreaButton="False"  >
                </rsweb:ReportViewer>
            </div>
        </form>
    </body>
    </html>

    Any help appreciated!

    LAS




    Wednesday, May 10, 2017 8:44 PM

Answers

  • Hi Linda Sarah Amy,

    To make the Report Viewer control fit the size of report, you can

    • assign the height, width value in a hard coded way that  is enough for the entire height of the report
    • set two properties to make the repoertviewer autosize: AsyncRendering = false;  and  SizeToReportContent = true

    Reference: ReportViewer control height issue
    Report automatically fit in an iframe

    Best regards,
    Yuliana Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Yuliana Gu Monday, May 15, 2017 2:11 AM
    • Marked as answer by Linda Sarah Amy Friday, May 26, 2017 8:21 PM
    Thursday, May 11, 2017 6:25 AM