我有一个网站,我在IE8/IE9、Chrome和FireFox中为每个人建了一个很好的网站。但是,现在我的客户端也要求它在IE7中工作,因为那里的机器仍然有IE7。我不知道ReportViewer控件有什么问题。任何帮助都将不胜感激。
问题是,我的报告超出了设定的高度和宽度;它不停留在我使用jQuery包装的DIV中
jQuery码
$(document).ready(function () {
var htmlwidth = $('.main').width() - 20;
var htmlheight = $(document).height() - $('.header').height() - 45;
$('#<%= ReportViewer1.ClientID %>').wrap('<div style="overflow:auto;" />');
$('#<%= ReportViewer1.ClientID %>').parent().css(height, htmlheight);
$('#<%= ReportViewer1.ClientID %>').parent().css('width', htmlwidth);
$('#<%= ReportViewer1.ClientID %>').css('width', htmlwidth);
$('#<%= ReportViewer1.ClientID %>').css(height, htmlheight);
$('#<%= ReportViewer1.ClientID %>').parent().css('border', 'solid 1px Black');
});含量
<asp:ScriptManager ID="scManager" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="100%" Width="100%"
SizeToReportContent="true" ZoomMode="Percent" AsyncRendering="false" >
</rsweb:ReportViewer>示例生成的块{content + jQuery Code}
<div style="width:500px; overflow:auto; border:solid 1px Black;height:400px;">
<asp:ScriptManager ID="scManager" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="400px" Width="500px"
SizeToReportContent="true" ZoomMode="Percent" AsyncRendering="false" >
</rsweb:ReportViewer>
</div>发布于 2011-07-12 12:57:32
看起来您正面临IE7溢出问题。您可以阅读更多关于它的here。
若要修复问题,请将外部div设置为具有position: relative
将以下行添加到jQuery中:
$('#<%= ReportViewer1.ClientID %>').parent().css(position, relative);或将以下内容添加到wrap()中
$('#<%= ReportViewer1.ClientID %>').wrap('<div style="overflow:auto; position:relative;" />');最后的输出应该如下所示:
<div style="width:500px; overflow:auto; border:solid 1px Black;height:400px; position:relative;">
<asp:ScriptManager ID="scManager" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="400px" Width="500px"
SizeToReportContent="true" ZoomMode="Percent" AsyncRendering="false" >
</rsweb:ReportViewer>
</div>https://stackoverflow.com/questions/6664436
复制相似问题