I have installed CR13SP33 x86 & x64 runtime and also installed CRforVS6413 and I am able to get crystalReportViewer on ToolBar, create ASP.NET with .net framework 4.8, and dragged the control to the aspx page. but on design view, I am getting the following error, and on execution its blank page, note that my crystal report file already has data in it
this is my aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" width="1200px" Height="800px"/>
</body>
</html>
web.xml config file
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.8">
<assemblies>
<add assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669E0DDF0BB1AA2A"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.8"/>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer "/>
</compilers>
</system.codedom>
</configuration>
and my C# code to load CRystal report file
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument myReportDocument;
myReportDocument = new ReportDocument();
myReportDocument.Load(@"C:\Users\Serak\source\repos\WebApplication1\WebApplication1\ConsolidatedBalanceSheet.rpt");
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DisplayToolbar = true;
}
}
}
CodePudding user response:
Open the project, right-click the project, and add a reference.
Click Browse to go to program files/crystal Decisions/crystal report9, and search (including subdirectories) 'CrystalDecisions.VSDesigner.dll' below. Then OK.
If prompted, select "Yes".
Drag a ReportViewer to the view, there should be no error.
CodePudding user response:
You need to add the following code in web.config:
<system.web>
<compilation defaultLanguage="c#" debug="true"><assemblies><add assembly="CrystalDecisions.CrystalReports.Engine,
Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.ReportSource,
Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Shared,
Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Web,
Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies></compilation>
</system.web>
The version I use is different from yours, you need to change the relevant configuration according to your own information.