# 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>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTemplateForm-1.md). 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).

Namespace: [Radzen.Blazor](https://blazor.radzen.com/docs/api/Radzen.Blazor.md)

Assembly: Radzen.Blazor.dll

## Inheritance

- Object
- ComponentBase
- [RadzenComponent](https://blazor.radzen.com/docs/api/Radzen.RadzenComponent.md)
- [ValidatorBase](https://blazor.radzen.com/docs/api/Radzen.Blazor.ValidatorBase.md)
- RadzenNumericRangeValidator

## Implements

- IComponent
- IHandleEvent
- IHandleAfterRender
- [IRadzenFormValidator](https://blazor.radzen.com/docs/api/Radzen.IRadzenFormValidator.md)

## Syntax

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

## Examples

Age minimum validation:

```razor
<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:

```razor
<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

| Constructor | Description |
|-------------|-------------|
| `public RadzenNumericRangeValidator()` | 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>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTemplateForm-1.md). 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). |

## Properties

| Property | Type | Description |
|------|------|-------------|
| AllowNull | `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. |
| Max | `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.). |
| Min | `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.). |
| Text | `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"). |

## Methods

| Method | Returns | Description |
|------|---------|-------------|
| `Validate(IRadzenFormComponent component)` | `bool` |  |

## Inherited Members

- From [ValidatorBase](https://blazor.radzen.com/docs/api/Radzen.Blazor.ValidatorBase.md): BuildRenderTree, Component, Dispose, EditContext, Form, GetComponentCssClass, IsValid, OnAfterRenderAsync, Popup, PopupPosition, SetParametersAsync, messages
- From [RadzenComponent](https://blazor.radzen.com/docs/api/Radzen.RadzenComponent.md): AddContextMenu, Attributes, ContextMenu, Culture, CurrentStyle, Debounce, DefaultCulture, DefaultUICulture, Element, GetCssClass, GetId, GetIdAttribute, IsJSRuntimeAvailable, JSRuntime, Localize, MouseEnter, MouseLeave, OnBecameInvisible, OnContextMenu, OnInitialized, OnMouseEnter, OnMouseLeave, RaiseContextMenu, RaiseMouseEnter, RaiseMouseLeave, Reference, Style, UICulture, UniqueID, Visible
- From ComponentBase: Assets, AssignedRenderMode, DispatchExceptionAsync, InvokeAsync, OnAfterRender, OnInitializedAsync, OnParametersSet, OnParametersSetAsync, RendererInfo, ShouldRender, StateHasChanged

