Validating a Phone Number with a RegularExpressionValidator Control (VB.net) : Phone Number « Validation by Function « ASP.Net






Validating a Phone Number with a RegularExpressionValidator Control (VB.net)

<%@ Page Language=VB Debug=true %>
<HTML>
<HEAD>
<TITLE>Validating a Phone Number with a RegularExpressionValidator Control</TITLE>
</HEAD>
<form runat="server">
<BR><BR>
Please enter your phone number:<BR>
<asp:textbox 
    id="txtPhoneNumber" 
    runat=server 
/>
<asp:regularexpressionvalidator 
    id="regZipCode"
    controltovalidate="txtPhoneNumber"
    validationexpression="\(\d{3}\) \d{3}\-\d{4}"
    display="Dynamic"
    font-name="Arial" 
    font-size="11"
    runat=server
>
    You must enter a phone number in the form of (999) 999-9999.
</asp:regularexpressionvalidator>
<BR><BR>
<asp:button 
    id="butOK"
    text="OK"
    type="Submit"
    runat="server"
/>
</form>
</BODY>
</HTML>
           
       








Related examples in the same category

1.Enter a valid phone number in the form xxx-xxx-xxxx (VB.net)