I am trying to make a textbox that doesn't allow to input numbers
I have tried some codes but doesn't work
Here is what I have tried:
<asp:RegularExpressionValidator runat="server" ID="txtSurnameValidation"
ControlToValidate="txtSurname" ValidationExpression="[a-zA-Z ]*$" Display="Dynamic">
</asp:RegularExpressionValidator>
its working but its not showing any message because you did not set any message in case validation fails so add ErrorMessage="* Alphabets Only" so that if someone enters numbers it will show this message
<asp:TextBox runat="server" ID="txtSurname"></asp:TextBox>
<asp:RegularExpressionValidator runat="server" ID="txtSurnameValidation"
ControlToValidate="txtSurname" ValidationExpression="[a-zA-Z ]*$" ErrorMessage="* Alphabets Only" Display="Dynamic">
</asp:RegularExpressionValidator>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With