我正在使用Visual Studio,ASP.NET。在我的项目中,我应该使用水晶报表。不幸的是,当我在asp.net中使用Crystal Report时,结果显示为空白页。
<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>
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
上C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319
和过去的入project root folder
如下视觉工作室:右键单击您的项目名称,然后选择 Open Folder On File Explorer
crystalreportviewers13
在此地址上粘贴带有名称的文件夹(项目根)
粘贴之后,回到Visual Studio中的解决方案,如果该文件夹是隐藏的,则可以执行以下操作:
点击Show All File
按钮
然后右键单击名称crystalreportviewers13
不带颜色图标的文件夹,然后选择Include In Project
<script type="text/javascript" src="/crystalreportviewers13/js/crviewer/crv.js"></script>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句