Partilhar via


Operator Property

  Microsoft Speech Technologies Homepage

Gets or sets the operator of the compare operation. Read/write.

Usage

ASP.NET markup: <speech:CompareValidator Operator="..." />
Get value: ValidationCompareOperator = CompareValidator.Operator;
Set value: CompareValidator.Operator = ValidationCompareOperator;
Data type: ValidationCompareOperator
Required: No; Default: Equal

Remarks

The Operator property must be one of Equal, NotEqual, GreaterThan, GreaterThanEqual, LesserThan, LesserThanEqual, or DataTypeCheck.

When Operator is DataTypeCheck, the control tests if SemanticItemToValidate can be converted to Type.

With all other values of Operator, the control compares SemanticItemToValidate with ValueToCompare or with SemanticItemToCompare. The order of operands relative to Operator is

SemanticItemToValidate Operator ValueToCompare

For example, if the SemanticItemToValidate references TextBox1 and the Operator is GreaterThan and the ValueToCompare is 10, the control requires the contents of TextBox1 to be greater than 10.

The control throws an exception for an invalid or unspecified ValidationCompareOperator.

Example

<form ID="Form1" method="post" runat="server">
  ...
  <Speech:CompareValidator ID="TestV1" Type="Integer" runat="server" 
    SemanticItemToValidate="siValue1" Operator="GreaterThan" ValueToCompare="256" >
    <Prompt InlinePrompt="Value1 must be greater than 256"></Prompt>
  </Speech:CompareValidator>

  <Speech:CompareValidator ID="TestV2" Type="Integer" runat="server" 
    SemanticItemToValidate="siValue2" Operator="GreaterThan" SemanticItemToCompare="siValue1" >
    <Prompt InlinePrompt="Value2 must be greater than Value1"></Prompt>
  </Speech:CompareValidator>
  ...
</form>

See Also

CompareValidator Class | CompareValidator Constructor | CompareValidator Members | CompareValidator Properties | CompareValidator Methods | CompareValidator Events | CompareValidator Remarks