This documentation is archived and is not being maintained.

BaseCompareValidator Class

Serves as the abstract base class for validation controls that perform typed comparisons.

For a list of all members of this type, see BaseCompareValidator Members.


[Visual Basic]
MustInherit Public Class BaseCompareValidator
   Inherits BaseValidator
public abstract class BaseCompareValidator : BaseValidator
public __gc __abstract class BaseCompareValidator : public
public abstract class BaseCompareValidator extends BaseValidator

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


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.

Note   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 additional information on validation controls, see BaseValidator.


Namespace: System.Web.UI.WebControls

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

BaseCompareValidator Members | System.Web.UI.WebControls Namespace | CompareValidator | RangeValidator | BaseValidator | Type | CanConvert | CutoffYear | GetFullYear