Skip to main content
All docs
V24.1

ParametersModel.OnSubmitParameters() Method

Applies parameter values and builds the document.

Namespace: DevExpress.Blazor.Reporting.Models

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

NuGet Package: DevExpress.Blazor.Reporting.Viewer

Declaration

public void OnSubmitParameters()

Remarks

The OnSubmitParameters method is called when a user clicks Submit in the Parameters panel. The method applies parameter values and creates a document.

The following page implements a 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