A validator component that ensures a numeric value falls within a specified minimum and maximum range. RadzenNumericRangeValidator is ideal for quantity limits, age restrictions, price ranges, or any bounded numeric input. Must be placed inside a RadzenTemplateForm<T>. Ensures values are within acceptable bounds by checking that the value is greater than or equal to Min and less than or equal to Max. Both bounds are inclusive. You can specify just Min to validate minimum value (e.g., age must be at least 18), just Max to validate maximum value (e.g., quantity cannot exceed 100), or both to validate range (e.g., rating must be between 1 and 5). Works with any IComparable type (int, decimal, double, DateTime, etc.). Set AllowNull = true to accept null values as valid (for optional nullable fields).
ValidatorBase.SetParametersAsync
ValidatorBase.GetComponentCssClass
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenNumericRangeValidator : ValidatorBase, IComponent, IHandleEvent, IHandleAfterRender, IRadzenFormValidatorAge minimum validation:
<RadzenTemplateForm TItem="Model" Data=@model>
<RadzenNumeric Name="Age" @bind-Value=@model.Age />
<RadzenNumericRangeValidator Component="Age" Min="18" Text="Must be 18 or older" Style="position: absolute" />
</RadzenTemplateForm>
Quantity range validation:
<RadzenTemplateForm TItem="Model" Data=@model>
<RadzenNumeric Name="Quantity" @bind-Value=@model.Quantity />
<RadzenNumericRangeValidator Component="Quantity" Min="1" Max="100"
Text="Quantity must be between 1 and 100" Style="position: absolute" />
</RadzenTemplateForm>A validator component that ensures a numeric value falls within a specified minimum and maximum range. RadzenNumericRangeValidator is ideal for quantity limits, age restrictions, price ranges, or any bounded numeric input. Must be placed inside a RadzenTemplateForm<T>. Ensures values are within acceptable bounds by checking that the value is greater than or equal to Min and less than or equal to Max. Both bounds are inclusive. You can specify just Min to validate minimum value (e.g., age must be at least 18), just Max to validate maximum value (e.g., quantity cannot exceed 100), or both to validate range (e.g., rating must be between 1 and 5). Works with any IComparable type (int, decimal, double, DateTime, etc.). Set AllowNull = true to accept null values as valid (for optional nullable fields).
public RadzenNumericRangeValidator()Gets or sets whether null values should be considered valid. When true, null values pass validation (useful for optional nullable fields). When false (default), null values fail validation.
public bool AllowNull { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether null values should be considered valid. When true, null values pass validation (useful for optional nullable fields). When false (default), null values fail validation. |
Gets or sets the maximum allowed value (inclusive). The component value must be less than or equal to this value. Can be null to only validate minimum. Works with any IComparable type (int, decimal, DateTime, etc.).
public IComparable Max { get; set; }
| Type | Description |
|---|---|
| IComparable | Gets or sets the maximum allowed value (inclusive). The component value must be less than or equal to this value. Can be null to only validate minimum. Works with any IComparable type (int, decimal, DateTime, etc.). |
Gets or sets the minimum allowed value (inclusive). The component value must be greater than or equal to this value. Can be null to only validate maximum. Works with any IComparable type (int, decimal, DateTime, etc.).
public IComparable Min { get; set; }
| Type | Description |
|---|---|
| IComparable | Gets or sets the minimum allowed value (inclusive). The component value must be greater than or equal to this value. Can be null to only validate maximum. Works with any IComparable type (int, decimal, DateTime, etc.). |
Gets or sets the error message displayed when the value is outside the valid range. Customize to provide specific guidance (e.g., "Age must be between 18 and 65").
public string Text { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the error message displayed when the value is outside the valid range. Customize to provide specific guidance (e.g., "Age must be between 18 and 65"). |
protected override bool Validate(IRadzenFormComponent component)
| Type | Name | Description |
|---|---|---|
| IRadzenFormComponent | component |
| Type | Description |
|---|---|
| bool |