I have the following RegularExpressionValidator
to allow only 4 digits number.
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtPinCode" Display="Dynamic" ErrorMessage="Please make sure to select a PIN with four numeric digits" ValidationExpression="^\d{4,4}$" CssClass="caption">4 Digits Pincode</asp:RegularExpressionValidator>
It does Validate but doesn't show the error message:
Please make sure to select a PIN with four numeric digits
Instead Keeps showing the text 4 Digits Pincode
. I want this text to get replaced by the Error message. Whats wrong?
Your "4 Digits Pincode" text goes into the Text property. This is defined as
the text displayed in the validation control when validation fails
The ErrorMessage property on the other hand is
the text for the error message displayed in a ValidationSummary control when validation fails
So they are both treated as error message, it's not "one or the other".
You maybe could use that "4 digit" text as placeholder on the input. Or just display it always, next to the validator.