Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144353 | May 2,2019 08:32 AM UTC | May 8,2019 07:38 AM UTC | ASP.NET Core | 9 |
![]() |
Tags: ReportViewer |
@page
@model IndexModel
@{
@ViewData["heading"];
}
<style>
body, html, #reportviewer {
overflow: hidden !important;
height: 100%;
width: 100%;
}
</style>
<ej-report-viewer id="reportviewer1" report-service-url="../ReportApi" processing-mode="Remote" />
<ej-script-manager></ej-script-manager>
|
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ReportViewerCore.Pages
{
public class IndexModel : PageModel
{
public void OnGet()
{
ViewData["heading"] = "ReportViewer Sample";
}
}
}
|
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Syncfusion.EJ.ReportViewer;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.AspNetCore.Hosting;
using System.IO;
namespace ReportViewerCore.API
{
public partial class ReportApiController : Controller, IReportController
{
private IMemoryCache _cache;
private IHostingEnvironment _hostingEnvironment;
public ReportApiController(IMemoryCache memoryCache, IHostingEnvironment hostingEnvironment)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
}
[HttpPost]
public object PostReportAction([FromBody] Dictionary<string, object> jsonResult)
{
return ReportHelper.ProcessReport(jsonResult, this, this._cache);
}
[ActionName("GetResource")]
[AcceptVerbs("GET")]
public object GetResource(ReportResource resource)
{
return ReportHelper.GetResource(resource, this, _cache);
}
[HttpPost]
public object PostFormReportAction()
{
return ReportHelper.ProcessReport(null, this, this._cache);
}
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
string basePath = _hostingEnvironment.WebRootPath;
FileStream reportStream = new FileStream(basePath + @"\ReportRDL\GroupingAgg.rdl", FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
}
public void OnReportLoaded(ReportViewerOptions reportOption)
{
}
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.