控制ReportViewer 寬100% 高100%
ReportViewer在展現時,如何在IE寬與高以百分比顯示,而不是固定的寬高呢?這樣的好處是,可以隨著使用者將IE拉大或縮小時,ReportViewer也能同時拉大或縮小,而不會在IE又多出現Score bar。
xxx.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
#region "Page Load畫面控制"
//Report Viewer control height to 100%
Response.Write(" <script language=javascript> self.moveTo(0,0) </script> ");
Response.Write(" <script> self.resizeTo(screen.availWidth,screen.availHeight) </script> ");
#endregion
}
xxx.aspx
<table style="width: 100%; height: 100%;" >
<tr valign="top" style="height:100%">
<td align="left" >
<rsweb:ReportViewer ID="ReportViewer" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="100%" ProcessingMode="Remote" ShowParameterPrompts="False" Width="100%"OnLoad="ReportViewer_Load" ShowPrintButton="False">
<ServerReport ReportServerUrl="" />
</rsweb:ReportViewer>
</td>
</tr>
</table>