This is a migrated thread and some comments may be shown as answers.

reporting support for .net core 2

1 Answer 160 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ahmed
Top achievements
Rank 1
ahmed asked on 19 Aug 2018, 02:00 PM

I am trying to run a report in a web application .net core 2 

I have followed the HTML5 Report Viewer in ASP.NET Core 2 Article with no success

I have added the below controller.

namespace schoolAppCore.Controllers
{
   [Route("api/reports")]
    public class ReportsController : Controller
    {
 
 
        string reportsPath = string.Empty;
 
        public ReportServiceConfiguration ReportServiceConfiguration { get; }
 
        public ReportsController(IHostingEnvironment environment)
        {
            this.reportsPath = Path.Combine(environment.WebRootPath, "Report1.trdp");
 
            this.ReportServiceConfiguration = new ReportServiceConfiguration
            {
                HostAppId = "schoolAppCore",
                Storage = new FileStorage(),
                ReportResolver = new ReportTypeResolver()
                                    .AddFallbackResolver(new ReportFileResolver(this.reportsPath)),
            };
        }
 
        [HttpGet("reportlist")]
        public IEnumerable<string> GetReports()
        {
            return Directory
                .GetFiles(this.reportsPath)
                .Select(path =>
                    Path.GetFileName(path));
        }
 
 
    }
 
}

 and also I have added a controller named to run the View as  following:

public class TelerikController : Controller
    {
public IActionResult viewreport()
        {
            return View("reportViewer");
        }
     

 

finally the Report view itself as following:

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <title></title>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
     
    <link href="~/styles/kendo.common.min.css" rel="stylesheet" />
    <link href="~/styles/kendo.blueopal.min.css" rel="stylesheet" />
 
    <script src="~/lib/Kendo/telerikReportViewer.kendo-12.1.18.620.min.js"></script>
    <script src="~/lib/Kendo/telerikReportViewer-12.1.18.620.min.js"></script>
 
    <style>
        #reportViewer1 {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 50px;
            bottom: 5px;
            overflow: hidden;
            font-family: Verdana, Arial;
        }
    </style>
 
</head>
<body>
    <div id="reportViewer1">
        loading...
    </div>
 
    <script>
        $(document).ready(function () {
            $("#reportViewer1")
                .telerik_ReportViewer({
                    serviceUrl: "api/reports/",
                    //"resources/templates/telerikReportViewerTemplate.html"
 
                    reportSource: {
                        // report: "Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary",
                        report: "Report1.trdp",
 
                        parameters: {}
                    },
                    viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                    scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                    scale: 1.0,
                });
        });
    </script>
</body>
</html>

 

I am getting the below error 

jquery.min.js:4 GET https://localhost:44332/telerik/api/reports/resources/templates/telerikReportViewerTemplate-html 404 ()

 

and also (viewreport:1 Uncaught (in promise) undefined)

can some one help in getting this run in core 2 Application 

 


1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 22 Aug 2018, 01:54 PM
Hello ahmed,

We have already addressed your questions in the support ticket you opened on the same topic.
For the benefit of our community I will summarize the answers also here :

The HTML5 Report Viewer is a pure HTML5/JavaScript/CSS3 jQuery-based widget that allows displaying Telerik Reporting reports in an HTML page. It can be added in any application, and does *not* require .NET framework.

On the other hand, Telerik Reporting engine relies on the GDI+ API that is available only in the full .NET framework, hence it should be built against the latter.
Note that the REST Service where the Reporting engine runs can be set up in a separate project built with the .NET framework, whereas the viewer can be hosted in a .NET Core application targeting .NET Core.

With the installation of Telerik Reporting we distribute CSharp|VB.Asp.NetCoreDemo example project that can be found in CSharp|VB.ReportExamples.VS2017.sln solution in (Telerik Reporting installation folder)\Examples\CSharp|VB (e.g. C:\Program Files (x86)\Progress\Telerik Reporting R2 2018\Examples\CSharp). You can compare the settings of your project with those of the demo and try to adjust them accordingly.

Note that the ReportsController must reside in a project targeting the full .NET Framework and must inherit Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
ahmed
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or