I use this code for decimal validation.It was working fine.but it allow to enter the alphabets into the text box. when i exit from the text box then only the error message will show nearby textbox.I need,if i press the alphabets the text box doesn’t allow to enter the text box , how to do this?
<asp:RegularExpressionValidator ControlToValidate="txtNumber"
runat="server" ValidationExpression="^[1-9]\d*(\.\d+)?$"
ErrorMessage="Please enter only numbers">
</asp:RegularExpressionValidator>
Using Javascript:
Javascript Code: