Using a RegularExpressionValidator Control to Prevent the Entry of a Special Character (VB.net) : Regular Expression Validator « Validation by Control « ASP.Net






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>
           
       








Related examples in the same category

1.Try validation based on Regular Expression in C#
2.Regular expression validator: ^\d{5}$|^\d{5}-\d{4}$ (VB.net)
3.A valid 5 digit zip code
4.Validate input of US SSN