zoukankan      html  css  js  c++  java
  • ReportViewer在Chrome 浏览器中无法显示的解决方法

         我在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);
                }
            }
        }
     

    然后我们使用重写过的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>

     

    参考的网上原文为:http://stackoverflow.com/questions/1784642/asp-net-reportviewer-google-chrome-cpu-usage 

  • 相关阅读:
    机器学习之线性回归
    最长回文字串——manacher算法
    linux系统下pdf操作软件pdftk
    markdown表格
    3.9 标准化,让运营数据落入相同的范围
    3.numpy_array数组
    4. 归并排序和快速排序
    3.病毒分裂
    2. 大整数乘法
    1.单峰序列
  • 原文地址:https://www.cnblogs.com/scottckt/p/2181267.html
Copyright © 2011-2022 走看看