Set up the report viewer in ASP.NET Core Razor Pages, load a template, and connect the component to the application.

Adding the viewer to a page. On a Razor page, add the @Html.StiNetCoreViewer helper with a StiNetCoreViewerOptions object that names the actions:
@page
@model IndexModel
@using Stimulsoft.Report.Mvc;

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
    Actions =
    {
        GetReport = "GetReport",
        ViewerEvent = "ViewerEvent"
    }
})

Serving the report from the page model. In Razor Pages the actions map to handler methods named On<Verb><Action>:
public class IndexModel : PageModel
{
    public IActionResult OnPostGetReport()
    {
        var report = new StiReport();
        report.Load(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt"));
        return StiNetCoreViewer.GetReportResult(this, report);
    }

    public IActionResult OnPostViewerEvent()
    {
        return StiNetCoreViewer.ViewerEventResult(this);
    }
}

The viewer requests the report on load and renders it in the browser; the GetReport action maps to the OnPostGetReport handler, and all further interaction returns to the same page model.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.