Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • RegularExpressionValidator control in asp.net

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 187
    Comment on it

    RegularExpressionValidator is very useful and powerful validation control in asp.net We can check the value of an associated input control that matches the pattern specified by a regular expression or not. The Property which is specific to RegularExpressionValidator is Property="ValidationExpression".

    EMAIL

    Invalid Email


    This example, checks if the input matches the pattern of an email address

    <asp:TextBox ID="txtEmail" runat="server" Width="150px">
    </asp:TextBox>
    
    <asp:RegularExpressionValidator ID="RegularExpressionValidatorEmail" runat="server" 
    ControlToValidate="txtEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
    ErrorMessage="Invalid Email" ForeColor="Red"></asp:RegularExpressionValidator> 
    

    By default client side validation is turned on. To disable client side validation set EnableClientScript o false. This property is supported by all validation controls.

    To disable validation control set Enabled propety to false.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: