Skip to main content
All docs
V24.2

DxReportViewer.ParametersModel Property

Provides access to report parameters.

Namespace: DevExpress.Blazor.Reporting

Assembly: DevExpress.Blazor.Reporting.v24.2.Viewer.dll

NuGet Package: DevExpress.Blazor.Reporting.Viewer

Declaration

public ParametersModel ParametersModel { get; }

Property Value

Type Description
ParametersModel

An object that contains report parameters and allows you to manage them.

Remarks

The ParametersModel property returns a ParametersModel object that allows you to get visible parameters, and reset or submit parameters in code. The reset or submit operation is equivalent to the user clicking the Reset or Submit button in the Parameters panel.

The following code is the OnCustomizeParameters event handler that obtains a ParameterModel for the specified parameter:

void OnCustomizeParameters(ParametersModel parameters)
{
    ParameterModel = parameters.VisibleItems
        .Where(param => param.Name == "OrderIdParameter")
        .FirstOrDefault();
}

The following code is a pagw with the stand-alone parameter editor:

@page "/standalonepanel/"

@using DevExpress.Blazor.Reporting
@using DevExpress.XtraReports.UI
@using BlazorCustomization.PredefinedReports
@using DevExpress.Blazor.Reporting.Models
@using DevExpress.Blazor
@using Models

<div class="cw-880">
    <EditForm Model="@OrdersModel"
              OnValidSubmit="@HandleValidSubmit"
              Context="EditFormContext">
        <DataAnnotationsValidator />
        <DxFormLayout CssClass="w-75 parameters-panel-custom">
            <DxFormLayoutItem Caption="Order Id:" ColSpanMd="4">
                <CustomCombobox Model=OrdersModel ParameterModel=ParameterModel />
            </DxFormLayoutItem>
            <DxFormLayoutItem ColSpanMd="1">
                <DxButton SubmitFormOnClick="true"
                          Text="Submit"
                          Title="Press the key to reload the report with the parameters."
                          RenderStyle="ButtonRenderStyle.Secondary" />
            </DxFormLayoutItem>
            <DxFormLayoutItem ColSpanMd="7">
                <ValidationSummary />
            </DxFormLayoutItem>
        </DxFormLayout>
    </EditForm>
</div>

<div style="width: 100%; height: calc(100% - 4rem);">
    <DxReportViewer @ref="reportViewer"
                    OnCustomizeParameters="OnCustomizeParameters"
                    Report="Report" />
</div>

@code {
    DxReportViewer reportViewer;
    XtraReport Report = new TableReport();
    OrdersModel OrdersModel = new OrdersModel();
    ParameterModel ParameterModel { get; set; }

    protected override void OnAfterRender(bool firstRender)
    {
        if (firstRender)
        {
            var parameterTab = reportViewer.TabPanelModel.Tabs
                .Where(Tab => Tab.ContentModel is ParametersModel)
                .FirstOrDefault();
            parameterTab.Visible = false;
            StateHasChanged();
        }
        base.OnAfterRender(firstRender);
    }

    void HandleValidSubmit()
    {
        if (!OrdersModel.OrdersData.Contains(OrdersModel.OrderId))
        {
            OrdersModel.OrdersData.Add(OrdersModel.OrderId);
            OrdersModel.OrdersData.Sort();
        }
        reportViewer.ParametersModel.OnSubmitParameters();
    }

    void OnCustomizeParameters(ParametersModel parameters)
    {
        ParameterModel = parameters.VisibleItems
            .Where(param => param.Name == "OrderIdParameter")
            .FirstOrDefault();
    }
}

View Example: Report Viewer for Blazor - Customization API

See Also