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,
Answers
- 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.
- Xhtml does not treat percentage height the same way as traditional html. Take a look at www.gotreportviewer.com, FAQ #14.
All Replies
- 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
<
script language="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:ReportViewer ID="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>
I gleened this navagation from the nifty tree view in the IE Developer Toolbar.
<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>
works like a charm! - Thaks dude you information is very useful
- I figured out a really simple way to get rid of the scrollbars. Put the ReportViewer control in a div and set the div's style to "overflow: visible;". The ReportViewer inherits this style and no more scrollbars.
Hi,
I found this forum to help me about ReportViewer Height.
I tried the JavaScript to help Remove the scroll bars, it works fine, thank you.
But I'm trying to use PromptAreaCollapsed () but I can't figure out how to use it.
<
script language="JavaScript" type="text/JavaScript">window.onload=
function RemoveScrollbars(){
var viewer = document.getElementById("<%=m_ReportViewer.ClientID %>");viewer.PreRender = PreRenderResize()
}
function
PreRenderResize(){
var viewer = document.getElementById("<%=m_ReportViewer.ClientID %>"); var htmlheight = document.documentElement.clientHeight;
if( viewer.PromptAreaCollapsed() == true ){
"px"; elseviewer.style.height = (htmlheight - 129) +
{
"px";viewer.style.height = (htmlheight - 241) +
}
}
</
script>Thanks for your help.
Freedon
- <%@ Page Language="VB" AutoEventWireup="false" CodeFile="TaskReportNewRender.aspx.vb" Inherits="Reports_TaskReportNewRender" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
html, body
{
margin:0;
padding:0;
}
</style>
</head>
<body>
<script language="JavaScript" type="text/JavaScript">
window.onresize = function ResizeReport() {
var viewer = document.getElementById("<%=ReportViewer1.ClientID %>");
viewer.PreRender = PreRenderResize()
}
window.onload=function RemoveScrollbars() {
window.st
var viewer = document.getElementById("<%=ReportViewer1.ClientID %>");
viewer.PreRender = PreRenderResize()
}
function PreRenderResize()
{
var viewer = document.getElementById("<%=ReportViewer1.ClientID %>");
var htmlheight = document.documentElement.clientHeight;
viewer.style.height = (htmlheight - 140) + "px";
}
</script>
<form id="form1" runat="server">
<div>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Width="100%">
</rsweb:ReportViewer>
</div>
</form>
</body>
</html> - this works perfectly. no javascript needed. just need to set AsyncRendering="false".
