BaseCompareValidator Class

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

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public ref class BaseCompareValidator abstract : public BaseValidator
public abstract class BaseCompareValidator extends BaseValidator
public abstract class BaseCompareValidator extends BaseValidator
Not applicable.

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.

NoteNote:

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.

NoteNote:

When you use validator controls that derive from the BaseCompareValidator control inside an 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 UpdatePanel control for partial-page updates, see Partial-Page Rendering Overview.

For more information about 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.

System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.Label
         System.Web.UI.WebControls.BaseValidator
          System.Web.UI.WebControls.BaseCompareValidator
             System.Web.UI.WebControls.CompareValidator
             System.Web.UI.WebControls.RangeValidator

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

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: