Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crystal Report doesnt display in ASP.net webpage which is build by using VS 2013

I am developing a website using ASP.NET and I want to display a report in my webform. I am using crystal report as my reporting tool. I am using visual studio 2013 as my IDE. This what I have tried. (My SAP version is to 13.0.9).

private void loadReport()
    {
        ReportDocument rpt = new ReportDocument();
        rpt.Load("D:\\Report_Test.rpt");
        rpt.VerifyDatabase();

        CrystalReportViewer1.ReportSource = rpt;

    }

above code works fine with visual studio 2010 but not in 2013. When I load the page it is empty. Not throwing any errors. so, How can view Crystal Report using Visual Studio 2013 ?.

like image 778
Iresh Avatar asked Nov 05 '14 09:11

Iresh


1 Answers

The first thing to check,is whether the report viewer clientside files are available, I suspect that's your issue (you may find it's silently throwing a javascript error!). In IIS it should have created a virtual directory, if IIS express, then you'll need to move the files the viewer needs manually, the following should work:

Create a folder called crystalreportviewers13 folder in the root your application, copy the contents of the folder C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\Crystal Reports 2011\crystalreportviewers into that folder (the source path seems to vary on different machines).

Add this to the configsections of your web.config

<configSections>
<sectionGroup name="businessObjects">
  <sectionGroup name="crystalReports">
    <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
    <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
  </sectionGroup>
</sectionGroup>

Then add this into the configuration section of your web.config

<businessObjects>
<crystalReports>
  <rptBuildProvider>
    <add embedRptInResource="true" />
  </rptBuildProvider>
  <crystalReportViewer>
    <add key="ResourceUri" value="/crystalreportviewers13" />
   </crystalReportViewer>
</crystalReports>
</businessObjects>

And it should work....

I'd first download the latest version from here http://scn.sap.com/docs/DOC-7824

If it still doesn't display check your web.config is pointing at the right version. If you've still got problems, then check the doc type in your HTML declaration - as I recall it doesn't work properly with HTML5.

Edit:

In earlier versions of crystal that folder I mentioned above is automatically copied into c:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319 - if you copy the whole aspnet_client into the root of your application that resolved the issue - in the later versions of crystal I believe that if you don't have IIS running when you install it doesn't create that folder anyway.

like image 134
Jim Avatar answered Oct 25 '22 04:10

Jim