All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Specify Parameter Values in a Blazor Report Viewer (Native) Application

  • 2 minutes to read

Use the Parameters Panel

Open the Parameters Panel and use its editors to specify parameter values. Click Submit to apply the values to the report and display the document.

Use the Parameters Panel to specify parameter values in a Blazor Report Viewer (Native) application

Use the Report Viewer’s API

The Report Viewer‘s API allows you to use custom UI elements or a URL’s query string to submit parameter values to the report. Implement a method that handles the submitted values as follows:

  1. Create a report instance and apply the parameter values to it. Reference each parameter by name in the report’s Parameters collection and assign the value to the parameter’s Value property.

  2. If you want custom UI elements (or a URL’s query string) to be the only way to submit parameter values, hide the Parameters Panel. To do this, disable the Visible property for all report parameters. If you want users to submit parameter values from both the panel and custom UI elements (or a URL’s query string), disable the report’s RequestParameters property.

  3. Call the viewer’s OpenReportAsync method and pass the report to this method.

The following example demonstrates how to submit a parameter value on button click and implement the button’s onclick event handler to pass the value to the report:

View Example

@page "/viewer"

@using DevExpress.Blazor.Reporting
@using DevExpress.XtraReports;
@using BlazorApp.Reports;

<link rel="stylesheet" href="_content/DevExpress.Blazor/dx-blazor.css">
<link rel="stylesheet" href="_content/DevExpress.Blazor.Reporting.Viewer/css/dx-blazor-reporting-components.css">

<input @bind="paramValue" />

<button @onclick="SubmitParameter">Submit</button>

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

@code {
    DxReportViewer reportViewer;
    string paramName = "strParam";
    string paramValue = "0";
    IReport Report;

    protected override async Task OnInitializedAsync() {
        var report = new XtraReport1();
        report.Parameters[paramName].Visible = false;
        Report = report;
    }

    async Task SubmitParameter() {
        var report = new XtraReport1();
        report.Parameters[paramName].Value = paramValue;
        report.Parameters[paramName].Visible = false;
        await reportViewer.OpenReportAsync(report);
    }
}