Friday, March 30, 2012

ReportViewer Height

Hello,

I try to embed my Reports of Reporting Services to ASP .NET Application. I use ReportViewer component of Visual Studio 2005.
When I try to set Height property to 100% there is no report content shown. I tried to set SizeToReportContent property but there wasn't success.
At the same time when I set Height to any particular value e.g. 400px, everything is OK. But of cousre I can't know particular height for every reports.
Did you have any such problems? Can you help me?

Thank you,Xhtml does not treat percentage height the same way as traditional html. Take a look at www.gotreportviewer.com, FAQ #14.|||I also cannot get SizeToReportContent = True to work on my web form report viewer controls. Is this a bug or are we overlooking something?|||SizeToReportContent has no effect when AsyncRendering = true. If you set AsyncRendering = false, which renders the report contents inline (versus being in an iframe), then SizeToReportContent will work.|||I wrote some javascript to size the report after it was loaded, using the AsyncRendering = true.|||

When I set AsyncRendering=true, I get an error message when the user tries to navigate to the second page of my report: " Page navigation is out of range."

When I set AsyncRendering=false, it works correctly.

I am using a remote report.

|||

korggy wrote:

When I set AsyncRendering=true, I get an error message when the user tries to navigate to the second page of my report: " Page navigation is out of range."

When I set AsyncRendering=false, it works correctly.

I am using a remote report.

I figured out a workaround. See this post.

|||

Would it be possible to post your javascript?

I still get scrollbars even when AsyncRendering=false SizeToReportContent=true

|||

dreadjr wrote:

I wrote some javascript to size the report after it was loaded, using the AsyncRendering = true.

Can you please share that with the rest of us please?

|||

This is the script that I am using. If you resize a window, you then have to refresh the page to resize the viewer, but there is probably a workaround for that, too.

css style

.fullheight{margin-bottom:120px;}

javascript

<scriptlanguage="JavaScript"type="text/JavaScript">

window.onload=function resize(){

var viewer = document.getElementById("<%=ReportViewer1.ClientID %>");

var htmlheight = document.documentElement.clientHeight;

viewer.style.height = (htmlheight - 120) + "px";

}

</script>

<rsweb:ReportViewerID="ReportViewer1"runat="server"Font-Names="Verdana"Font-Size="8pt"

ProcessingMode="Remote"Width="100%"CssClass="fullheight">

</rsweb:ReportViewer>

|||thanks for pointing me in the right direction. I wrote this to get rid of the duplicate scrollbars in async mode.

<body>

<script language="JavaScript" type="text/JavaScript">

window.onload=function RemoveScrollbars()

{

document.getElementById("<%=ReportViewer1.ClientID %>").lastChild.firstChild.style.overflow = "visible";

}

</script>

<form runat="server" action="Report.aspx" >

<rsweb:ReportViewer

ID="ReportViewer1"

runat="server"

ProcessingMode="Remote"

AsyncRendering="false"

SizeToReportContent="true" />

</form>

</body>

I gleened this navagation from the nifty tree view in the IE Developer Toolbar.

works like a charm!

sql

No comments:

Post a Comment