Mega Code Archive

 
Categories / ASP.Net / Validation By Function
 

Using a RegularExpressionValidator Control to Test a Zip Code with validationexpression (VB net)

<%@ Page Language=VB Debug=true %> <HTML> <HEAD> <TITLE>Using a RegularExpressionValidator Control to Test a Zip Code</TITLE> </HEAD> <form runat="server"> <BR><BR> Please enter a 5-digit Zip Code:<BR> <asp:textbox      id="txtZipCode"      runat=server  /> <asp:regularexpressionvalidator      id="regZipCode"     controltovalidate="txtZipCode"     validationexpression="^\d{5}$"     display="Dynamic"     font-name="Arial"      font-size="11"     runat=server >     Zip code must be a number in the form of 12345. </asp:regularexpressionvalidator> <BR><BR> <asp:button      id="butOK"     text="OK"     type="Submit"     runat="server" /> </form> </BODY> </HTML>