Validation ASP.Net Tutorial

<%@ Page Language="C#"%>



    Using CompareValidator Control


    
    

      
      Age:
      
               ControlToValidate="txtAge" 
         ValueToCompare="18"
         Operator="LessThanEqual"
         SetFocusOnError="true"
         Text="You are too old to view this site" />
      
        
        Sales Date:
        
                   ControlToValidate="txtDate" 
           Operator="DataTypeCheck"
           Type="Date"
           Text="Enter a valid date" />
        
              
        
        Quantity:
        
                      ControlToValidate="txtQuantity" 
           Operator="DataTypeCheck"
           Type="Integer"
           Text="Enter a valid whole number" />   
        
        Enter Password:
        
        
        Reenter Password:
        
        
                   ControlToValidate="txtPass2" 
           Operator="Equal"
           ControlToCompare="txtPass1"
           Text="Passwords must match" />