Iframe size

Apr 17, 2015 at 2:51 AM
Hi armanio123,

Thanks for putting up this project.

The size of the iframe is set to default size of ReportViewer of 400x400px

Before I write my own script to do it, Is there a mean to set the iframe size using the library?

Regards,
Coordinator
Apr 17, 2015 at 8:48 PM
Edited Apr 17, 2015 at 8:49 PM
Hi danielsg,

There is no need to create your own script, the project already does that for you.

You'll just need to setup the ReportViewer control on the controller like below:
ReportViewer reportViewer = new ReportViewer()
{
    SizeToReportContent = true,
    Width = Unit.Percentage(100),
    Height = Unit.Percentage(100),
};
or using the anonymous extension on the View:
@Html.ReportViewer(
    new
    {
        ProcessingMode = ProcessingMode.Local,
        SizeToReportContent = true,
        Width = Unit.Percentage(100),
        Height = Unit.Percentage(100)
    },
    new { ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\Report1.rdlc" }
)
Note that on both examples I'm using the libraries Microsoft.Reporting.WebForms and System.Web.UI.WebControls.
May 5, 2015 at 3:16 AM
Thanks for the reply.

I got the result I wanted with this.
<script type="text/javascript">
    $(document).ready(function () {
        $("iframe[src*='Viewer']").width("100%");
    });

</script>
Dec 18, 2015 at 12:31 PM
Edited Dec 18, 2015 at 12:36 PM
Hi everyone,
@armanio123 - your solution works great but there is one problem with it.
I have report with 2 fields where I can select date using date-time picker provided by reporting service.
The loaded form (1.) looks good, but if I click on calendar icon it's not enough height to see full calendar control (2.):
Image

Is there any parameter to set min-height size working with SizeToReportContent parameter?
Dec 18, 2015 at 1:43 PM
For my previous question:
It can be done with the following code (thanks @danielsg :) ):
<script type="text/javascript">
    $(document).ready(function () {
        $("iframe[src*='Viewer']").attr('style', 'min-height: 480px !important;  ');
    });
</script>