RegularExpressionValidator ErrorMessage not cleared.
Posted on 2008-06-17
I have the following code to validate creditcard using RegularExpressionValidator. When I enter a valid credit card no 1111111111111111, it doesn't show an error message which is good. When I enter an invalid credit card no 11, it does show the error message which is also good. But the problem I have is when I enter back the credit card no 1111111111111111, it doesn't clear the error message. If I delete the credit card no, it clears the error message and when I enter back 1111111111111111, it doesn't show any error message.
<asp:TextBox Columns="35" CssClass="Content" ID="CreditCardNumber" MaxLength="19" Runat="server"/>
<asp:RegularExpressionValidator ID="regExCreditCardNumber" runat="server"
ControlToValidate="CreditCardNumber" Display="Dynamic" ValidationExpression="Some Expression" ErrorMessage="Please enter a valid Credit Card Number" />