JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the CompareValidator Class

You use a comparison validator to compare the value entered by the user into an data-entry control with the value entered into another data-entry control or a constant value. Comparison validators are supported by the CompareValidator class, and here is the inheritance hierarchy for this class:

Object
   Control
      WebControl
         Label
            BaseValidator
               BaseCompareValidator
                  CompareValidator

You can find the notable public properties of CompareValidator objects in Table 18.6. (This class has no non-inherited methods or events.) Note that as with other Web server controls, I am not listing the notable properties, methods, and events this class inherits from the Control and WebControl classes—you can find them in Chapter 15, Tables 15.1 to 15.5. This class inherits the BaseValidator class, which you can find in Tables 18.2 and 18.3, the BaseCompareValidator class, which you can see in Table 18.5, as well as the Label class; the Label class has only one non-inherited public member—the Text property, which holds the text the label displays.

Table 18.6: Noteworthy public properties of CompareValidator objects.

Property

Means

ControlToCompare

Gets/sets the data-entry control you want to compare to the data-entry control you want to validate.

Operator

Gets/sets the comparison operation you want to use.

ValueToCompare

Gets/sets the constant value you want to compare with the value in the data-entry control you want to validate.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor