http://blog.csdn.net/even0220/article/details/8630192
Vs2010中使用ReportViewer显示报表。在IE下显示正常,但到Chrome下无法显示报表,但报表工具条可以显示。说明数据有取出,但无法显示。在网上找到了解决方法。
主要原因是ReportViewer中的Js在Chrome下会造成死循环。
解决方法是重写ReportViewer的Render事件。具体代码如下。
public
class
MyReportViewer : Microsoft.Reporting.WebForms.ReportViewer
{
protected override void Render(HtmlTextWriter writer)
{
using (StringWriter sw = new StringWriter())
{
HtmlTextWriter tmpWriter = new HtmlTextWriter(sw);
base .Render(tmpWriter);
string val = sw.ToString();
val = val.Replace( @" != 'javascript:\'\'' " , @" != 'javascript:\'\'' && false " );
writer.Write(val);
}
}
}
{
protected override void Render(HtmlTextWriter writer)
{
using (StringWriter sw = new StringWriter())
{
HtmlTextWriter tmpWriter = new HtmlTextWriter(sw);
base .Render(tmpWriter);
string val = sw.ToString();
val = val.Replace( @" != 'javascript:\'\'' " , @" != 'javascript:\'\'' && false " );
writer.Write(val);
}
}
}
然后我们使用重写过的MyReportViewer加载报表数据。 Html代码如下:
<
cc1:MyReportViewer
ID
="rvSignUp"
runat
="server"
EnableTheming
="false"
Width
="100%"
Height ="100%" ShowWaitControlCancelLink ="false" ShowPromptAreaButton ="false"
ShowCredentialPrompts ="false" ShowExportControls ="false" SizeToReportContent ="true" >
</ cc1:MyReportViewer >
Height ="100%" ShowWaitControlCancelLink ="false" ShowPromptAreaButton ="false"
ShowCredentialPrompts ="false" ShowExportControls ="false" SizeToReportContent ="true" >
</ cc1:MyReportViewer >
参考的网上原文为:http://stackoverflow.com/questions/1784642/asp-net-reportviewer-google-chrome-cpu-usage
============================================================================================
方法2:
- <table id="reportviewertable" align="center">
- <tr>
- <td>
- <asp:Label ID="lblErrorMessage" runat="server" Font-Bold="True" ForeColor="Red" Visible="False" />
- </td>
- </tr>
- <tr>
- <td width="760px">
- <rsweb:ReportViewer ID="rvRepViewer" runat="server" width="100%" height="100%"
- ZoomMode="PageWidth" ShowBackButton="true" SizeToReportContent="True" />
- </td>
- </tr>
- </table>
这样可以出现导出按钮。再来打印。
rdlc chrome
http://baidu.ku6.com/watch/04673935940513489912.html?page=videoMultiNeed