CompareValidator Remarks
The CompareValidator control compares an element of data entered by the user with another data element, or with a constant value.
The SemanticItemToValidate property of the CompareValidator control references the SemanticItem containing the data to be validated. The CompareValidator is activated when this data is changed or confirmed, depending on the setting of the ValidationEvent property. The data to be validated is compared either with data in the control that is referenced by the SemanticItemToCompare property, or with constant data in the ValueToCompare property.
The Operator property specifies the type of comparison, such as equal to, less than for example. If the result of the comparison is False, CompareValidator invalidates the item specified by SemanticItemToValidate. If the result is False and the InvalidateBoth property is True, the SemanticItemToValidate and SemanticItemToCompare fields are both invalidated.
When the result of the comparison is False, the CompareValidator plays its Prompt to inform the user that the data is not valid.
When creating a Speech CompareValidator control to validate data collected by a QA control, ensure either that the validator immediately precedes the QA in the source code, or that the validator's SpeechIndex property follows the SpeechIndex property of the QA. When the data is invalid, the dialog manager RunSpeech activates the validator to play a prompt message, and then reactivates the QA control. For more details, see Management of Speech Validator Controls and the RunSpeech Example.
The CompareValidator has a similar purpose to the CustomValidator control. The CompareValidator supports validation with a fixed set of operators, and the CustomValidator supports validation using application-specific client-side scripts specified by its ClientValidationFunction property.
Markup
<speech:CompareValidator Properties runat="server" >
<Prompt ... />
</speech:CompareValidator>
See Also
CompareValidator Class | CompareValidator Constructor | CompareValidator Members | CompareValidator Properties | CompareValidator Methods | CompareValidator Events