Integrating the Report Viewer into an Application
Our sample projects and report templates can help you learn the basics of working with our products.The React report viewer is backed by an ASP.NET Core controller: it initializes the viewer, serves the report, and handles viewer events.
Initialize the viewer and serve the report.
How it works. The React viewer component talks to these controller actions, so the report is served and driven entirely through the .NET backend.
Initialize the viewer and serve the report.
[HttpPost]
public IActionResult InitViewer()
{
var requestParams = StiReactViewer.GetRequestParams(this);
var options = new StiReactViewerOptions();
options.Actions.GetReport = "GetReport";
options.Actions.ViewerEvent = "ViewerEvent";
return StiReactViewer.ViewerDataResult(requestParams, options);
}
[HttpPost]
public IActionResult GetReport()
{
var report = StiReport.CreateNewReport();
report.Load(StiReactHelper.MapPath(this, "Reports/MasterDetail.mrt"));
return StiReactViewer.GetReportResult(this, report);
}StiReactViewer.ViewerDataResult(requestParams, options)— theInitVieweraction that configures the React viewer.Actions.GetReport/ViewerEvent— name the controller actions the viewer calls for the report and for events.
How it works. The React viewer component talks to these controller actions, so the report is served and driven entirely through the .NET backend.