2

我有一个包含 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();

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

这是它的显示方式

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

请告知我在 asp.net 网络表单中缺少什么以使报告正确显示。

4

3 回答 3

5

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

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

于 2013-02-01T10:43:25.760 回答
1

尝试设置 HasDrilldownTabs="False" 示例

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

同样适用于我的情况谢谢

于 2014-01-16T17:23:07.013 回答
0

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

于 2013-11-27T13:04:50.593 回答