DxReportViewer.OnCustomizeParameters Event
Allows you to specify custom editors for report parameters.
Namespace: DevExpress.Blazor.Reporting
Assembly: DevExpress.Blazor.Reporting.v24.2.Viewer.dll
NuGet Package: DevExpress.Blazor.Reporting.Viewer
Declaration
Parameters
Type | Description |
---|---|
ParametersModel | An object that contains report parameters and allows you to manage them. |
Remarks
Handle the OnCustomizeParameters event to modify parameter settings and specify custom parameter editors.
Example: Customize Parameter Editor with Template
Implement a custom editor as a razor component. The following code is the
CustomInt.razor
file that contains an editor based on the DxSpinEdit<T> component for integer values in the range 0-10:<DxSpinEdit @bind-Value="@EditorValue" MinValue="0" MaxValue="10"></DxSpinEdit> @code { Int32 EditorValue { get { return (Int32)Value; } set { Value = value; ValueChanged.InvokeAsync(value); } } [Parameter] public object Value { get; set; } [Parameter] public EventCallback<object> ValueChanged { get; set; } }
Handle the OnCustomizeParameters event and specify the
CustomInt
component as the editor’s template:<DxReportViewer @ref="reportViewer" OnCustomizeParameters="OnCustomizeParameters"> </DxReportViewer> @code { DxReportViewer reportViewer; void OnCustomizeParameters(ParametersModel parametersModel) { foreach (var parameter in parametersModel.VisibleItems) { if (parameter.Type == typeof(int)) { parameter.ValueTemplate = GetIntEditorTemplate(parameter); } } } RenderFragment GetIntEditorTemplate(ParameterModel paramModel) { return @<CustomInt @bind-value="@paramModel.Value"></CustomInt>; } }
Example: Stand-Alone Parameter Editor
You can bind the ParameterModel to an editor on the page. Review the following example: