Wednesday, January 21, 2015

Compare Validator DataTypeCheck


I have been using asp.net Validator controls for quite long. I have come across the unexplored property of Compare Validator which can check input against following types

1) Currency
2) Date
3) Double
4) Integer 
5) String

you can use the Validator by setting the following properties

Operator="DataTypeCheck"

Select any of the below types for data type check

Type= Currency
            Date
            Double
            Integer 
            String

Example:

<asp:CompareValidator ID="CompareValidatorNumber" runat="server" ControlToValidate="txtTelephone" Text="*" Display="Dynamic" ErrorMessage="Please enter numbers only" Operator="DataTypeCheck" Type="String"></asp:CompareValidator>


No comments: