Share via


Type Property (CompareValidator)

Sets and returns the data type of the two values being compared. The default value is string.

public System.Web.UI.WebControls.ValidationDataType Type {
   get,
   set
}

RemarksThe following table contains the definitions of the ValidationDataType enumerations.

Enumeration Value Data type
String 0 String
Integer 1 Integer
Double 2 Double
Date 3 DateTime
Currency 4 Currency

Exceptions

Exception type Condition
ArgumentException The specified value is not one of the ValidationDataType values.

For more information about argument exceptions or validation data types, see the ASP.NET documentation.

Remarks

The values are implicitly converted to the specified data type before the comparison is made. If the data conversion fails, data validation fails.

See Also

Applies to: CompareValidator Class