zimmer9
asked on
I use the following RegularExpressionValidator to try and accept only alphanumeric characters but it allows special characters as well. Do you kow how I can fix this?
I am developing an ASP.NET application using C#.
I use the following RegularExpressionValidator to try and accept only alphanumeric characters.
However, the application accepts "Special Characters".
Do you know what I am doing wrong?
<asp:TextBox ID="txtaccountNum" runat="server" Text='<%# Eval("accountNum") %>'></asp:TextBox>
<asp:RequiredFieldValidato r ID="RequiredFieldValidator 6" runat="server" ControlToValidate="txtacco untNum" Display="Dynamic" ErrorMessage="Account # is required" SetFocusOnError="true" ForeColor="Red" ValidationGroup="AllValida tors"></as p:Required FieldValid ator>
<asp:RegularExpressionVali dator ID="RegularExpressionValid ator9" runat="server"
ErrorMessage="Enter alphanumeric characters only."
ControlToValidate="txtamou nt" ForeColor="#FF0066"
SetFocusOnError="true"
ValidationExpression="^[0- 9a-zA-Z]+$ ">
</asp:RegularExpressionVal idator>
I use the following RegularExpressionValidator
However, the application accepts "Special Characters".
Do you know what I am doing wrong?
<asp:TextBox ID="txtaccountNum" runat="server" Text='<%# Eval("accountNum") %>'></asp:TextBox>
<asp:RequiredFieldValidato
<asp:RegularExpressionVali
ErrorMessage="Enter alphanumeric characters only."
ControlToValidate="txtamou
SetFocusOnError="true"
ValidationExpression="^[0-
</asp:RegularExpressionVal
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.