Back to Devexpress

Load a Report in Blazor Report Viewer

xtrareports-403611-web-reporting-blazor-reporting-native-report-viewer-load-a-report.md

latest3.8 KB
Original Source

Load a Report in Blazor Report Viewer

  • Feb 09, 2026
  • 3 minutes to read

This document describes how to open a report in the Blazor Report Viewer.

Open a Predefined Report

You can instantiate a report (an XtraReport or CachedReportSource instance) and use one of the following options to load the report to the Report Viewer:

The DxReportViewer.Report property

Assign an XtraReport instance (or CachedReportSource instance for large documents) to the Report property to open a report:

razor
@page "/reportviewer/"

@using DevExpress.Blazor.Reporting
@using DevExpress.XtraReports.UI
@using DXApplication.PredefinedReports

<DxReportViewer @ref="reportViewer" Report="Report"/>

@code {
    DxReportViewer reportViewer;
    XtraReport Report = new TestReport();
}

The DxReportViewer.OpenReportAsync(IReport) method

Allows you to load a report asynchronously. Pass an XtraReport instance (or CachedReportSource instance for large documents):

razor
@page "/reportviewer/"

@using DevExpress.Blazor.Reporting
@using DevExpress.XtraReports.UI
@using DXApplication.PredefinedReports

<DxReportViewer @ref="reportViewer"/>

@code {
    DxReportViewer reportViewer;
    XtraReport Report = new TestReport();

    protected override void OnAfterRender(bool firstRender) {
        if (firstRender) {
            reportViewer.OpenReportAsync(Report);
        }
    }
}

Load a Report from REPX

If you pass a report name to the Report property or the OpenReportAsync method, you need to implement IReportProvider / IReportProviderAsync and register it at application startup. This service resolves a report name to a report instance.

  1. Implement the IReportProvider interface. The following code snippet creates a service that translates the report name to the report instance:

  2. Register the service at application startup:

  3. Pass the report name to the DxReportViewer.Report property or DxReportViewer.OpenReportAsync(IReport) method.

Open Subreports

The XRSubreport control defines additional reports (subreports) included in the host report. The control’s ReportSource property specifies the report instance used as a subreport, and the ReportSourceUrl property specifies the report name. The ReportSourceUrl property has priority over the ReportSource property.

A subreport is opened automatically alongside the main report. To open a subreport, the Report Viewer passes the XRSubreport.ReportSourceUrl property value to available report name resolution services. Use the IReportProviderAsync service to resolve report names for both the main report and subreports.