views:

1134

answers:

3

In my asp.net application, I am trying to open a particular report. I have the ReportViewer Control set with width of 100% and height of 100%. Now I expect that to mean that the report will take up the entire page. Well to my surprise, it does not. In IE7 while it takes the entire width of the page, it only takes up a small portion of the height. In Firefox, both the width and the height are messed up. I have the browser open up a new page that takes up almost all of the screen. Any ideas?

Thanks!

+2  A: 

This is an issue with XHTML 1.1 standard. Change your page doctype to transitional to get 100% height working:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/&gt;

Or if you still struggle, remove it completely.

HTH, Mark

Mark Cooper
It was using transitional already. If I remove the doctype entirely, the issue goes away in IE7, but not in FireFox.
Dan Appleyard
+3  A: 

Give is a static height that is enough for the entire height of the report, as far as I know 100% will not work because the ReportViewer control is essentially wrapped by one big div tag.

mccrager
I tried the static height and it seems to work for both IE7 and FireFox. Thanks
Dan Appleyard
A: 

This is the way I fixed, take a look

<div style="Width:auto;"> 
<form id="form1" runat="server" style="width:100%; height:100%;">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <rsweb:ReportViewer ID="rptViewer" runat="server" Width="100%" Height="100%" AsyncRendering="False" SizeToReportContent="True">
    </rsweb:ReportViewer>
</form></div>

The thing doing the magic is AsyncRendering="False" SizeToReportContent="True" the rest is basic HTML. The report will be displayed as it was designed.

There might be some code extra, but see if it works for you.

Hope it helps

Sergio