RangeValidator Class
Assembly: System.Web (in system.web.dll)
The RangeValidator control tests whether the value of an input control is within a specified range.
The RangeValidator control uses four key properties to perform its validation. The ControlToValidate property contains the input control to validate. The MinimumValue and MaximumValue properties specify the minimum and maximum values of the valid range.
The BaseCompareValidator.Type property is used to specify the data type of the values to compare. The values to compare are converted to this data type before the validation operation is performed. The following table lists the different data types that can be compared.
| Data Type | Description |
|---|---|
| String | A string data type. |
| Integer | A 32-bit signed integer data type. |
| Double | A double-precision floating point number data type. |
| Date | A date data type. |
| Currency | A decimal data type that can contain currency symbols. |
Note |
|---|
| Validation succeeds if the input control is empty. Use a RequiredFieldValidator control to make the input control a mandatory field. |
Note |
|---|
| The RangeValidator control throws an exception if the value specified by the MaximumValue or MinimumValue property cannot be converted to the specified BaseCompareValidator.Type. |
For additional information on validation controls, see BaseValidator.
Accessibility
The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note