RadzenNumericRangeValidator Class

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).

Inheritance

Object

ComponentBase

RadzenComponent

ValidatorBase

RadzenNumericRangeValidator

Implements

IComponent

IHandleEvent

IHandleAfterRender

IRadzenFormValidator

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenNumericRangeValidator : ValidatorBase, IComponent, IHandleEvent, IHandleAfterRender, IRadzenFormValidator

Examples

Age 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>

Constructors

RadzenNumericRangeValidatorlink

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).

Declaration
public RadzenNumericRangeValidator()

Properties

AllowNulllink

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.

Declaration
public bool AllowNull { get; set; }
Property Value
Type Description
boolGets 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.

Maxlink

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.).

Declaration
public IComparable Max { get; set; }
Property Value
Type Description
IComparableGets 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.).

Minlink

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.).

Declaration
public IComparable Min { get; set; }
Property Value
Type Description
IComparableGets 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.).

Textlink

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").

Declaration
public string Text { get; set; }
Property Value
Type Description
stringGets 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").

Methods

Validatelink

Declaration
protected override bool Validate(IRadzenFormComponent component)
Parameters
Type Name Description
IRadzenFormComponent component
Returns
Type Description
bool
An error has occurred. This app may no longer respond until reloaded. Reload 🗙