ASP.Net CrystalReportViewer只渲染垂直线条

时间:2012-12-09 06:21:33

标签: asp.net crystal-reports

我有一个包含CrystalReportViewer的普通asp.Net页面。我在Page_Load方法中使用以下代码来显示报告:

ReportDocument report = new ReportDocument();
                    TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                    TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
                    ConnectionInfo crConnectionInfo = new ConnectionInfo();
                    Tables CrTables;

                    report.Load(Server.MapPath("Reports\\" + Request.Params[0]));

                    crConnectionInfo.ServerName = ConfigurationManager.AppSettings["ReportSQLServer"];
                    crConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["ReportSQLDatabase"];
                    crConnectionInfo.UserID = ConfigurationManager.AppSettings["ReportSQLUsername"];
                    crConnectionInfo.Password = ConfigurationManager.AppSettings["ReportSQLPassword"];

                    CrTables = report.Database.Tables;
                    foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                    {
                        crtableLogoninfo = CrTable.LogOnInfo;
                        crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                        CrTable.ApplyLogOnInfo(crtableLogoninfo);
                    }

                    Session["Report"] = report;
                    rptViewer.ReportSource = report;
                    rptViewer.RefreshReport();

但是,无论我加载什么报告,它都显示如下:

This is how it displays

当我在WinForms应用程序中使用完全相同的逻辑在那里填充CrystalReportsViewer时,报告会按预期显示。

请告知我在asp.net网络表单中缺少的内容,以便正确显示报告。

3 个答案:

答案 0 :(得分:5)

我在IE10中遇到同样的问题,在IE10浏览器模式下,垂直条纹在reportviewer中显示而不是数据。

解决方案是切换“IE10兼容模式”,一切正常

答案 1 :(得分:1)

尝试设置 HasDrilldownTabs = “假” 示例

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" ReportSourceID="CrystalReportSource1"
                        HasDrilldownTabs="False"/>

同样适用于我的情况  感谢

答案 2 :(得分:0)

或者,在页面的头部添加<meta http-equiv="x-ua-compatible" content="IE=9">