Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
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)
Visual Basic (Declaration)
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public MustInherit Class BaseCompareValidator _
    Inherits BaseValidator
Visual Basic (Usage)
Dim instance As BaseCompareValidator
C#
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public abstract class BaseCompareValidator : BaseValidator
Visual C++
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class BaseCompareValidator abstract : public BaseValidator
JScript
public abstract class BaseCompareValidator extends BaseValidator
ASP.NET
<asp:BaseCompareValidator />

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.

z8fh4ax6.alert_note(en-us,VS.90).gifNote:

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.

z8fh4ax6.alert_note(en-us,VS.90).gifNote:

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.

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 Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker