title: Decimal validation in server side textbox using C#
body: <p>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,<strong>if i press the alphabets the text box doesn't allow to enter the text box</strong> , how to do this?</p>
  
  <pre><code>&lt;asp:RegularExpressionValidator ControlToValidate="txtNumber" 
                      runat="server" ValidationExpression="^[1-9]\d*(\.\d+)?$"
                          ErrorMessage="Please enter only numbers"&gt;
                      &lt;/asp:RegularExpressionValidator&gt;
  </code></pre>