asp.net.ph

BaseCompareValidator.Type Property

System.Web.UI.WebControls Namespace


Sets or retrieves the data type that the values being compared are converted to before the comparison is made.

Syntax


Inline <asp:validator type = strDataType ... >
Script Validator.Type [ = strDataType ]

Property Value


strDataType String specifying one of the ValidationDataType values.

The property is read/write with a default value of String.

Exceptions


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

Remarks

Use the Type property to specify the data type used for comparison. The Type property is used differently by the various comparison validation controls.

For example, in the RangeValidator control, all values being compared ( the upper bound, lower bound, and value of the input control ) are converted to the specified data type before any comparison is performed.

However, if you use a CompareValidator control and set its Operator property to DataTypeCheck, only the value of the input control is converted to the specified data type.

If the value of the input control associated with the validation control cannot be converted to the specified data type, validation fails. The IsValid property of the validation control is set to false.

The following table lists the values that you can use for the Type property.

Data Type Description
String Specifies a string data type.
Integer Specifies a 32-bit signed integer data type.
Double Specifies a double precision floating point number data type.
Date Specifies a date data type.
Currency Specifies a monetary data type.

Example

The following example demonstrates how to use the Type property to specify the data type that values being compared are converted to before the comparison is made.

 Show me 

See Also

BaseCompareValidator Members   Validating Against a Data Type 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