javascript - ASP.NET中 Crystal 报表的空白结果问题

标签 javascript c# html asp.net crystal-reports

我正在使用 Visual Studio,ASP.NET。在我的项目中,我应该使用 Crystal 报表。很遗憾 当我在asp.net中使用 Crystal 报表时,结果显示空白页。

我的 HTML 代码:

<head runat="server">
<title>Crystal Report From More Than One Table</title>
</head>
<body>
<form id="form1" runat="server">
<table cellpadding="10" cellspacing="10" width="70%" height="300px" align="center"
style="border: solid 2px gray;">
<tr>
<td align="center" style="background-color: SkyBlue;">
<span style="font-family: Times New Roman; font-size: 18pt; color: Green;">Customer
Product Order Detail Report</span>
</td>
</tr>
<tr>
<td align="center">
<asp:Panel ID="pnlReport" runat="server" Height="400px">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
</asp:Panel>
</td>
</tr>
</table>
</form>
</body>

我的CS代码(代码隐藏):

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.CrystalReports.Engine;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(Server.MapPath("EmployeeCrystalReport.rpt"));
CrystalReportViewer1.ReportSource = cryRpt;
}
}

最佳答案

该代码是正确的,但您应该再执行两个步骤:

1) 复制 C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319 上名为 crystalreportviewers13 的文件夹并将其粘贴到项目根文件夹 在 Visual Studio 上如下:

右键单击您的项目名称,然后选择在文件资源管理器上打开文件夹

enter image description here

将名为 crystalreportviewers13 的文件夹粘贴到此地址(项目根目录)

enter image description here

粘贴后,返回到 Visual Studio 中的解决方案,如果该文件夹是隐藏的,您可以执行以下操作:

点击显示所有文件按钮

enter image description here

然后右键单击名为 crystalreportviewers13 且没有颜色图标的文件夹,然后选择包含在项目中

enter image description here

2) 在您的 html 头页上添加此 javascript:

<script type="text/javascript" src="/crystalreportviewers13/js/crviewer/crv.js"></script> 

享受!

关于javascript - ASP.NET中 Crystal 报表的空白结果问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60021956/

相关文章:

c# - 如何动态组合条件?

javascript - Marionette.CompositeView,如何将参数传递给Marionette.ItemView

javascript - js 文件声明中的 AngularJS 过滤器

javascript - 使用 React Hooks 的 If 语句中出现意外的 token 语法错误

c# - 在 C# 中从数据集中删除行的问题

c# - 使用 LINQ,我可以像在 C# 中那样在 VB.NET 中为 "grouping"命名吗?

html - 如何在同一页面的同一个div上应用两种不同的CSS样式?

ios - 当用户尝试在不可滚动部分滚动时,如何阻止整个 Web 应用程序在 iOS 中滚动?

javascript - 在检查谷歌表单的输入元素时,我找不到 "name"属性。如何找到它?

javascript - 使用 Jquery 更改选择值