Report body width to ReportViewer control width?? RRS feed

  • Question

  • I have several reports created. I want to get them to stretch to the width of the ReportViewer control.

    Currently they remain a static width and on some machines they show squeezed up.

    Is there a way to get the reports to either dynamically change with the Browser (like the reportviewer control does, or to make the reports be the size of the viewer by default?

    Thanks for any tips!
    Thursday, March 22, 2007 11:17 PM

All replies

  • There are two options, depending on exactly how you want it to render:


    1. Set ReportViewer.AsyncRendering = false and ReportViewer.SizeToReportContent = true




    2. Set ReportViewer.ZoomMode = ZoomMode.FullPage

    Monday, March 26, 2007 10:33 PM
  • Thank you for answering Brian, I appreciate it. I had come across option #1, and tried it but it did not work, report still static size.

    I will try #2 to see.

    Just wondering, does the DOCTYPE need to be a certain type for this(#1) to work, or is there another global attrib like a STYLE setting? Or perhaps do my controls need to have some setting?

    Also I noticed that when I did use #1, the page still had an IFRAME around the report.

    Thanks again.
    Thursday, March 29, 2007 1:52 AM
  • Setting AsyncRendering to false should remove the iframe and cause the report to be rendered inline.  It sounds like the property wasn't being set or perhaps set too late in the page execution cycle.  If you can still see an iframe with AsyncRendering = false, I'd like to take a look at a code snippet that reproduces the problem.
    Thursday, March 29, 2007 10:59 PM
  • Originally I had set the properties through the props window. Now I'm just putting it in the code. In firefox browser there's no dynamic page resize, in IE none either but I get scroll bars around the report area. Also IFRAME shows up on the page like this:

    <iframe name="ReportViewer1TouchSession0" id="ReportViewer1TouchSession0" onload="if (frames['ReportViewer1TouchSession0'].location != 'javascript:\'\'') frames['ReportViewer1TouchSession0'].location.replace('javascript:\'\'');" src="javascript:''" style="position:absolute;width:0;height:0;visibility:hidden;">
    That is placed below the report area though, I had thought it was around the report. 
    Thanks so much Brian.
    Here's my code:

    private void ExecuteReport(DataTable theDT, string theReportName, string theRptDataSetName, ReportParameter[] theParams)








    ReportViewer1.LocalReport.SubreportProcessing+=new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);





    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource(theRptDataSetName, theDT));







    Friday, March 30, 2007 2:30 PM
  • This iframe doesn't contain the report.  Notice that the styles property specifies visibility as hidden.  This frame is used to keep your report session alive as long as the browser window is left open.
    Tuesday, April 10, 2007 2:38 AM
  • OK, But still the report does not resize dynamically. I presume nothing's wrong with the way I set the parameters to allow that to happen. So I'm still stuck with static sized pages even though I'm doing what I'm supposed to do.

    Friday, April 13, 2007 7:17 PM
  • I think I am have a similar problem.  I am using a report viewer and I want it to display to the height and width of the webpage.  I try and set the viewer H & W to 100%, this works for the width, but the height reverts to 100px. So I change the height to 1000 or 2000px, which displays my report but I get two vertical scroll bars, which is cumbersome.


    In a different post, I saw a response saying "resize web report viewer control on size to report" but I cannot find this property. 


    Any clues on this?

    Tuesday, April 24, 2007 11:24 AM
  • I still haven't found a way around this. Looks like we're stuck with static sized reports.
    Tuesday, April 24, 2007 4:05 PM