System.Web.UI.WebControls.BaseCompareValidator Class

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

See Also: BaseCompareValidator Members

Syntax

public abstract class BaseCompareValidator : BaseValidator

Remarks

The System.Web.UI.WebControls.BaseCompareValidator class is inherited by validation controls that compare values, such as the System.Web.UI.WebControls.CompareValidator and System.Web.UI.WebControls.RangeValidator controls, to provide basic common functionality.

Use the BaseCompareValidator.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 BaseValidator.IsValid property of the validation control is set to false.

The System.Web.UI.WebControls.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 BaseCompareValidator.CanConvert(string, ValidationDataType) method. The maximum year that can be represented by a two-digit year is contained in the BaseCompareValidator.CutoffYear property. The BaseCompareValidator.GetFullYear(int) method allows you to convert a two-digit year to a four-digit year.

Note:

When you use validator controls that derive from the System.Web.UI.WebControls.BaseCompareValidator control inside an System.Web.UI.UpdatePanel control, make sure that the validator control and the control it is associated with are in the same panel. For more information about using the System.Web.UI.UpdatePanel control for partial-page updates, see Partial-Page Rendering Overview.

For more information about validation controls, see System.Web.UI.WebControls.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.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0