System.Web.UI.WebControls Namespace CompareValidator Class
Sets or retrieves the comparison operation to perform.
Inline |
<asp:comparevalidator operator = ValidationCompareOperator ... > |
Script |
CompareValidator.Operator = ValidationCompareOperator |
The property is read/write with a default valueof Equal.
Use the Operator property to specify the comparison operation to perform.
Setting the Operator property to DataTypeCheck will just validate to the specified Type. No comparison to ControlToCompare or ValueToCompare is made.
The following example demonstrates how to programmatically set the Operator property of a CompareValidator at run time, based on a selected value.
void setOperator ( Object src, EventArgs e ) {
compValidator.Operator = ( ValidationCompareOperator ) ListOperator.SelectedIndex;
compValidator.Validate ( );
}
Show me
CompareValidator Members Validating Against a Specific Value