Easy Tutorial
❮ Prop Webcontrol Calendar Daystyle Met Websecurity Requireroles ❯

ASP.NET RangeValidator Control



Definition and Usage

The RangeValidator control is used to check if the user input value is between two specified values. It can compare values of different types, such as numbers, dates, and strings.

Note: If the input control is empty, validation does not fail. Use the RequiredFieldValidator control to make the field required.

Note: If the input value cannot be converted to the specified data type, validation does not fail. Use the CompareValidator control and set its Operator property to ValidationCompareOperator.DataTypeCheck to validate the data type of the input value.


Properties

Property Description
BackColor The background color of the RangeValidator control.
ControlToValidate The ID of the control to validate.
Display The display behavior of the validation control. Valid values are: None - The control does not display. Used only to display error messages in the ValidationSummary control.<br> Static - The control displays an error message if validation fails. Space for the message is reserved on the page even if the input passes validation.<br> Dynamic - The control displays an error message if validation fails. Space for the message is dynamically added to the page if the input passes validation.
EnableClientScript A Boolean value that specifies whether client-side validation is enabled.
Enabled A Boolean value that specifies whether the validation control is enabled.
ErrorMessage The text displayed in the ValidationSummary control when validation fails. Note: If the Text property is not set, this text is also displayed in the validation control.
ForeColor The foreground color of the control.
id The unique ID of the control.
IsValid A Boolean value indicating whether the control specified by ControlToValidate passed validation.
MaximumValue The maximum value of the input control.
MinimumValue The minimum value of the input control.
runat Specifies that the control is a server control. Must be set to "server".
Type The data type of the value to be checked. Types include: Currency<br> Date<br> Double<br> Integer<br> String
Text The message displayed when validation fails.

Examples

RangeValidator

RangeValidator 2


❮ Prop Webcontrol Calendar Daystyle Met Websecurity Requireroles ❯