Validation By Control ASP.Net

<%@ Page Language="vb" %>


   Validation Control Example
    
    
   
   
      Sub Page_Load()
         vsSummary.DisplayMode = ValidationSummaryDisplayMode.List
      End Sub
      Sub ServerValidation (source As object, args As ServerValidateEventArgs)
         Dim RegExVal As New System.Text.RegularExpressions.Regex("^\d{4}$")
         If RegExVal.IsMatch(args.Value) Then
            args.IsValid = True
         Else
            args.IsValid = False
         End If
      End Sub
   


   

Validation Control Example


   
      
         
            
               Compare Validator Control:
               


               Enter two numbers to compare
            
            
               

               

                                 controltovalidate="value1" 
                  controltocompare="value2" 
                  operator="equal" 
                  type="integer" 
                  errormessage="Fields are not equal!" 
                  display="dynamic" 
                  runat="server"/>
            
         
         
            
               ValidationSummary Control:
            
            
                                 displaymode="bulletlist" 
                  headertext="Page has the following errors: "
                  showsummary="true" 
                  showmessagebox="false"
                  runat="server"/>