asp.net.ph

CompareValidator.Operator Property

System.Web.UI.WebControls Namespace   CompareValidator Class


Sets or retrieves the comparison operation to perform.

Syntax


Inline <asp:comparevalidator operator = ValidationCompareOperator ... >
Script CompareValidator.Operator = ValidationCompareOperator

Property Value


ValidationCompareOperator String specifying one of the ValidationCompareOperator values.

The property is read/write with a default valueof Equal.

Exceptions


Exception Type Condition
ArgumentException The given value is not one of the ValidationCompareOperator values.

Remarks

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.

Example

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 

See Also

CompareValidator Members   Validating Against a Specific Value Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph