using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace ReportsCoreSamples.Controllers.ReportViewer
{
[Route("report-viewer/sales-by-year")]
public class SalesByYearController : PreviewController
{
[HttpGet("")]
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
@inject Globals globals;
@section control {
<bold-report-viewer id="reportviewer" report-service-url="@Globals.SERVICE_URL" report-path="sales-by-year.rdlc" report-loaded="onReportLoaded" processing-mode="Local" toolbar-rendering="onToolbarRendering" tool-bar-item-click="onToolBarItemClick" export-item-click="onExportItemClick" />
<script>
function onReportLoaded(args) {
let reportNameWithoutExt = args.model.reportPath.split(".")[0];
let reportObj = $('#reportviewer').data("boldReportViewer");
reportObj.model.dataSources = rdlcData[reportNameWithoutExt];
}
</script>
}