New to Telerik Reporting? Download free 30-day trial

Methods and Commands Overview

The Blazor Report Viewer exposes methods and commands that allow to control its behavior from application code.

Get a report viewer reference to access API

To call report viewer methods and execute commands it is required to first get a reference to the report viewer object using the @ref attribute. Then use the reportViewer1 object to access the report viewer API. For example, refresh and print of the current report can be triggered like this:

<button type="button" class="btn btn-light btn-sm" @onclick="RefreshReport">Refresh Report</button>
<button type="button" class="btn btn-light btn-sm" @onclick="Print">Print Report</button>
...
<ReportViewer @ref="reportViewer1"
...
@code {
    ReportViewer reportViewer1;
    async void RefreshReport()
    {
        await reportViewer1.RefreshReportAsync();
    }
    async void Print()
    {
        await reportViewer1.Commands.Print.ExecuteAsync();
    }
}
In this article