ASP.Net - Compare Validator

Sample of it’s usage

<asp:CompareValidator 
    runat="server" 
    Operator="DataTypeCheck" 
    Type="Integer" 
    ControlToValidate="ValueTextBox" 
    ErrorMessage="Value must be a whole number" />

Where

  • Operator - the type of operation that is going on. Common values
    • DataTypeCheck - means you want to confirm the value in the control is capable of going into a variable of a certain type
  • Type - If Operator=DataTypeCheck then this is the type of data you want the control validated against

Additional Information