Decimal validation in server side textbox using C#

Posted by V.V on Stack Overflow See other posts from Stack Overflow or by V.V
Published on 2012-10-23T10:58:03Z Indexed on 2012/10/23 11:00 UTC
Read the original article Hit count: 129

Filed under:
|
|
|
|

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 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>

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET