Mega Code Archive

 
Categories / ASP.Net / Validation By Control
 

Using a RegularExpressionValidator Control to Prevent the Entry of a Special Character (VB net)

<%@ Page Language=VB Debug=true %> <HTML> <HEAD> <TITLE>Using a RegularExpressionValidator Control to Prevent the Entry of a Special Character</TITLE> </HEAD> <form runat="server"> <BR><BR> Enter a value that does not include the ' character:<BR> <asp:textbox      id="txtValue"      runat=server  /> <asp:regularexpressionvalidator      id="regZipCode"     controltovalidate="txtValue"     validationexpression="[^']*"     display="Dynamic"     font-name="Arial"      font-size="11"     runat=server >     You must not use the ' character. </asp:regularexpressionvalidator> <BR><BR> <asp:button      id="butOK"     text="OK"     type="Submit"     runat="server" /> </form> </BODY> </HTML>