BaseCompareValidator Class
Assembly: System.Web (in system.web.dll)
The BaseCompareValidator class is inherited by validation controls that compare values, such as the CompareValidator and RangeValidator controls, to provide basic common functionality.
Use the Type property to specify the data type that that the values are converted to before being compared.
![]() |
---|
If the value of the input control being validated cannot be converted to the specified data type, validation fails. The IsValid property of the validation control is set to false. |
The BaseCompareValidator class also contains several static properties and methods that are useful when performing comparison validations. You can determine whether a string can be converted to a specific data type by using the CanConvert method. The maximum year that can be represented by a two-digit year is contained in the CutoffYear property. The GetFullYear method allows you to convert a two-digit year to a four-digit year.
For more 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.
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
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.