Wednesday, March 28, 2012

ReportViewer control and scaling issue

When using the reportviewer control on a web page, we would like to set the
width and heighth to a percentage of the container that it is placed in. It
appears that the defaults are 400px. Of course these can be changed, but you
may experience horizontal and/or vertical scroll bars or a window that is too
large for the report. What we are trying to achieve is to have the contents
of the exposed SRS report scale properly when the size of the browser window
is changed. Has anyone else come across or tried to solve this issue ?Keith,
What I did was create one table with one cell and set the height and width
to 100%. Next put the report viewer control inside the table and set the
height and width to lets say 95%(this can be flexible whatever fits your
situation). The outside table will act as a container and will adjust
appropriately to the users screen resolution and the ReportViewer control
will just follow the tables lead.
--
Andrew
MCSA,MCDBA
--
Andrew
MCSA,MCDBA
"Keith" wrote:
> When using the reportviewer control on a web page, we would like to set the
> width and heighth to a percentage of the container that it is placed in. It
> appears that the defaults are 400px. Of course these can be changed, but you
> may experience horizontal and/or vertical scroll bars or a window that is too
> large for the report. What we are trying to achieve is to have the contents
> of the exposed SRS report scale properly when the size of the browser window
> is changed. Has anyone else come across or tried to solve this issue ?
>|||Thank you for the response.
I did try that as evidenced in this code:
<table id="rptViewer" runat=server align=center width="100%"
height="100%">
<tr>
<td>
<rsweb:ReportViewer ID="ReportViewer1" runat="server"
Font-Names="Verdana" Font-Size="8pt" Height="95%" ProcessingMode="Remote"
Width="95%" ShowCredentialPrompts="true">
<ServerReport
ReportPath="/chartingtest/horizontalreport_large"
ReportServerUrl="http://localhost/reportserver" />
</rsweb:ReportViewer>
</td>
</tr>
</table>
As you can see I am using SQL Reporting Services ReportViewer control. With
this configuration, nothing is rendered within the reportviewer when I run
the application. From what I see, the ReportViewer is not accepting a
percenrtage width.
Any other ideas are greatly appreciated.
"Andrew" wrote:
> Keith,
> What I did was create one table with one cell and set the height and width
> to 100%. Next put the report viewer control inside the table and set the
> height and width to lets say 95%(this can be flexible whatever fits your
> situation). The outside table will act as a container and will adjust
> appropriately to the users screen resolution and the ReportViewer control
> will just follow the tables lead.
> --
> Andrew
> MCSA,MCDBA
> --
> Andrew
> MCSA,MCDBA
>
> "Keith" wrote:
> > When using the reportviewer control on a web page, we would like to set the
> > width and heighth to a percentage of the container that it is placed in. It
> > appears that the defaults are 400px. Of course these can be changed, but you
> > may experience horizontal and/or vertical scroll bars or a window that is too
> > large for the report. What we are trying to achieve is to have the contents
> > of the exposed SRS report scale properly when the size of the browser window
> > is changed. Has anyone else come across or tried to solve this issue ?
> >|||I have experienced the same difficulty. When the Height property of the
reportviewer control is set to a percentage, it appears that the report does
not display - only the toolbar and parameters. The width as a percentage
seems to work just fine.
Is this a bug in the ReportViewer control? Is there a workaround or fix?
Mike
"Keith" wrote:
> Thank you for the response.
> I did try that as evidenced in this code:
> <table id="rptViewer" runat=server align=center width="100%"
> height="100%">
> <tr>
> <td>
> <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> Font-Names="Verdana" Font-Size="8pt" Height="95%" ProcessingMode="Remote"
> Width="95%" ShowCredentialPrompts="true">
> <ServerReport
> ReportPath="/chartingtest/horizontalreport_large"
> ReportServerUrl="http://localhost/reportserver" />
> </rsweb:ReportViewer>
> </td>
> </tr>
> </table>
>
> As you can see I am using SQL Reporting Services ReportViewer control. With
> this configuration, nothing is rendered within the reportviewer when I run
> the application. From what I see, the ReportViewer is not accepting a
> percenrtage width.
> Any other ideas are greatly appreciated.
>
>
> "Andrew" wrote:
> > Keith,
> > What I did was create one table with one cell and set the height and width
> > to 100%. Next put the report viewer control inside the table and set the
> > height and width to lets say 95%(this can be flexible whatever fits your
> > situation). The outside table will act as a container and will adjust
> > appropriately to the users screen resolution and the ReportViewer control
> > will just follow the tables lead.
> > --
> > Andrew
> > MCSA,MCDBA
> >
> > --
> > Andrew
> > MCSA,MCDBA
> >
> >
> > "Keith" wrote:
> >
> > > When using the reportviewer control on a web page, we would like to set the
> > > width and heighth to a percentage of the container that it is placed in. It
> > > appears that the defaults are 400px. Of course these can be changed, but you
> > > may experience horizontal and/or vertical scroll bars or a window that is too
> > > large for the report. What we are trying to achieve is to have the contents
> > > of the exposed SRS report scale properly when the size of the browser window
> > > is changed. Has anyone else come across or tried to solve this issue ?
> > >|||Please see Question 14 in the FAQ: http://www.gotreportviewer.com/
--
Rajeev Karunakaran [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael R" <MichaelR@.discussions.microsoft.com> wrote in message
news:B9AE8223-6164-4B8A-89F3-30181B62583F@.microsoft.com...
>I have experienced the same difficulty. When the Height property of the
> reportviewer control is set to a percentage, it appears that the report
> does
> not display - only the toolbar and parameters. The width as a percentage
> seems to work just fine.
> Is this a bug in the ReportViewer control? Is there a workaround or fix?
> Mike
> "Keith" wrote:
>> Thank you for the response.
>> I did try that as evidenced in this code:
>> <table id="rptViewer" runat=server align=center width="100%"
>> height="100%">
>> <tr>
>> <td>
>> <rsweb:ReportViewer ID="ReportViewer1" runat="server"
>> Font-Names="Verdana" Font-Size="8pt" Height="95%" ProcessingMode="Remote"
>> Width="95%" ShowCredentialPrompts="true">
>> <ServerReport
>> ReportPath="/chartingtest/horizontalreport_large"
>> ReportServerUrl="http://localhost/reportserver" />
>> </rsweb:ReportViewer>
>> </td>
>> </tr>
>> </table>
>>
>> As you can see I am using SQL Reporting Services ReportViewer control.
>> With
>> this configuration, nothing is rendered within the reportviewer when I
>> run
>> the application. From what I see, the ReportViewer is not accepting a
>> percenrtage width.
>> Any other ideas are greatly appreciated.
>>
>>
>> "Andrew" wrote:
>> > Keith,
>> > What I did was create one table with one cell and set the height and
>> > width
>> > to 100%. Next put the report viewer control inside the table and set
>> > the
>> > height and width to lets say 95%(this can be flexible whatever fits
>> > your
>> > situation). The outside table will act as a container and will adjust
>> > appropriately to the users screen resolution and the ReportViewer
>> > control
>> > will just follow the tables lead.
>> > --
>> > Andrew
>> > MCSA,MCDBA
>> >
>> > --
>> > Andrew
>> > MCSA,MCDBA
>> >
>> >
>> > "Keith" wrote:
>> >
>> > > When using the reportviewer control on a web page, we would like to
>> > > set the
>> > > width and heighth to a percentage of the container that it is placed
>> > > in. It
>> > > appears that the defaults are 400px. Of course these can be changed,
>> > > but you
>> > > may experience horizontal and/or vertical scroll bars or a window
>> > > that is too
>> > > large for the report. What we are trying to achieve is to have the
>> > > contents
>> > > of the exposed SRS report scale properly when the size of the browser
>> > > window
>> > > is changed. Has anyone else come across or tried to solve this issue
>> > > ?
>> > >|||I added the following code to my body tag - and it worked!!! The
reportviewer control acts as if the height were set to 100% (give or take,
based on what you subtract from the 'clientHeight'). I also added the script
to the onload event, so my report will always be the correct height.
<body
onresize="javascript:document.getElementById('ReportViewer1').style.height =document.documentElement.clientHeight - 100;">
hope this helps. Enjoy!
Mike Rainey
"Michael R" wrote:
> I have experienced the same difficulty. When the Height property of the
> reportviewer control is set to a percentage, it appears that the report does
> not display - only the toolbar and parameters. The width as a percentage
> seems to work just fine.
> Is this a bug in the ReportViewer control? Is there a workaround or fix?
> Mike
> "Keith" wrote:
> > Thank you for the response.
> >
> > I did try that as evidenced in this code:
> > <table id="rptViewer" runat=server align=center width="100%"
> > height="100%">
> > <tr>
> > <td>
> > <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> > Font-Names="Verdana" Font-Size="8pt" Height="95%" ProcessingMode="Remote"
> > Width="95%" ShowCredentialPrompts="true">
> > <ServerReport
> > ReportPath="/chartingtest/horizontalreport_large"
> > ReportServerUrl="http://localhost/reportserver" />
> > </rsweb:ReportViewer>
> > </td>
> > </tr>
> > </table>
> >
> >
> > As you can see I am using SQL Reporting Services ReportViewer control. With
> > this configuration, nothing is rendered within the reportviewer when I run
> > the application. From what I see, the ReportViewer is not accepting a
> > percenrtage width.
> >
> > Any other ideas are greatly appreciated.
> >
> >
> >
> >
> > "Andrew" wrote:
> >
> > > Keith,
> > > What I did was create one table with one cell and set the height and width
> > > to 100%. Next put the report viewer control inside the table and set the
> > > height and width to lets say 95%(this can be flexible whatever fits your
> > > situation). The outside table will act as a container and will adjust
> > > appropriately to the users screen resolution and the ReportViewer control
> > > will just follow the tables lead.
> > > --
> > > Andrew
> > > MCSA,MCDBA
> > >
> > > --
> > > Andrew
> > > MCSA,MCDBA
> > >
> > >
> > > "Keith" wrote:
> > >
> > > > When using the reportviewer control on a web page, we would like to set the
> > > > width and heighth to a percentage of the container that it is placed in. It
> > > > appears that the defaults are 400px. Of course these can be changed, but you
> > > > may experience horizontal and/or vertical scroll bars or a window that is too
> > > > large for the report. What we are trying to achieve is to have the contents
> > > > of the exposed SRS report scale properly when the size of the browser window
> > > > is changed. Has anyone else come across or tried to solve this issue ?
> > > >|||I have the same issue with the control not recognizing height. I am going to
submit it as a bug even though this workaround *may* work its very kludgey
and the bug should be fixed (or else and explanation should be made here by
MS).
"Michael R" wrote:
> I added the following code to my body tag - and it worked!!! The
> reportviewer control acts as if the height were set to 100% (give or take,
> based on what you subtract from the 'clientHeight'). I also added the script
> to the onload event, so my report will always be the correct height.
> <body
> onresize="javascript:document.getElementById('ReportViewer1').style.height => document.documentElement.clientHeight - 100;">
> hope this helps. Enjoy!
> Mike Rainey
>
> "Michael R" wrote:
> > I have experienced the same difficulty. When the Height property of the
> > reportviewer control is set to a percentage, it appears that the report does
> > not display - only the toolbar and parameters. The width as a percentage
> > seems to work just fine.
> >
> > Is this a bug in the ReportViewer control? Is there a workaround or fix?
> >
> > Mike
> >
> > "Keith" wrote:
> >
> > > Thank you for the response.
> > >
> > > I did try that as evidenced in this code:
> > > <table id="rptViewer" runat=server align=center width="100%"
> > > height="100%">
> > > <tr>
> > > <td>
> > > <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> > > Font-Names="Verdana" Font-Size="8pt" Height="95%" ProcessingMode="Remote"
> > > Width="95%" ShowCredentialPrompts="true">
> > > <ServerReport
> > > ReportPath="/chartingtest/horizontalreport_large"
> > > ReportServerUrl="http://localhost/reportserver" />
> > > </rsweb:ReportViewer>
> > > </td>
> > > </tr>
> > > </table>
> > >
> > >
> > > As you can see I am using SQL Reporting Services ReportViewer control. With
> > > this configuration, nothing is rendered within the reportviewer when I run
> > > the application. From what I see, the ReportViewer is not accepting a
> > > percenrtage width.
> > >
> > > Any other ideas are greatly appreciated.
> > >
> > >
> > >
> > >
> > > "Andrew" wrote:
> > >
> > > > Keith,
> > > > What I did was create one table with one cell and set the height and width
> > > > to 100%. Next put the report viewer control inside the table and set the
> > > > height and width to lets say 95%(this can be flexible whatever fits your
> > > > situation). The outside table will act as a container and will adjust
> > > > appropriately to the users screen resolution and the ReportViewer control
> > > > will just follow the tables lead.
> > > > --
> > > > Andrew
> > > > MCSA,MCDBA
> > > >
> > > > --
> > > > Andrew
> > > > MCSA,MCDBA
> > > >
> > > >
> > > > "Keith" wrote:
> > > >
> > > > > When using the reportviewer control on a web page, we would like to set the
> > > > > width and heighth to a percentage of the container that it is placed in. It
> > > > > appears that the defaults are 400px. Of course these can be changed, but you
> > > > > may experience horizontal and/or vertical scroll bars or a window that is too
> > > > > large for the report. What we are trying to achieve is to have the contents
> > > > > of the exposed SRS report scale properly when the size of the browser window
> > > > > is changed. Has anyone else come across or tried to solve this issue ?
> > > > >|||Try removing the code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> at the top of the aspx
page.
I too had the same issue, but was able to fix it by deleting the above
code in my aspx page that hosted the reportviewer control.sql

No comments:

Post a Comment