javascript - asp.net中水晶报表的空白结果问题
问题描述
我正在使用视觉工作室,ASP.NET。在我的项目中,我应该使用水晶报告。不幸的是,当我在 asp.net 中使用水晶报表时,结果显示为空白页。
我的 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;
}
}
解决方案
该代码是正确的,但您应该多做两步:
crystalreportviewers13
1)复制名称为的文件夹C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319
并将其粘贴project root folder
到Visual Studio上,如下所示:
右键单击您的项目名称,然后选择Open Folder On File Explorer
将具有名称的文件夹粘贴crystalreportviewers13
到此地址(项目根目录)
粘贴之后,回到你在visual studio中的解决方案,如果文件夹被隐藏,你可以这样做:
点击Show All File
按钮
然后右键单击名称crystalreportviewers13
为没有颜色图标的文件夹并选择Include In Project
2)在您的 html 头页面上添加此 javascript:
<script type="text/javascript" src="/crystalreportviewers13/js/crviewer/crv.js"></script>
请享用!
推荐阅读
- postgresql - 将字符更改为时间戳
- javascript - TypeError: undefined is not an object - 使用 forEach 评估数组时
- java - 扫描仪+开关使用
- swift - 访问所有数组元素的子节点
- android - 当我尝试调试时,为什么 Android Studio 会打开 looper.java?
- javascript - 如何使用 data-url 打开下一个模式?
- java - Taskmanager 转储 - 可以使用 java/eclipse 内存分析器进行分析吗?
- php - 带有编程代码的文本区域内容未插入数据库
- reactjs - React Routes 受保护的路由
- javascript - 如何抑制错误:混合空格和制表符?