Numeric TextBox in ASP.Net

Numeric TextBox in ASP.Net
This example are shows how to extend textbox so it's only accepts number as an entry. User can't enter in the textbox anything else except number. Well the process of doing that is quite simple.
<title>Numeric TextBox in ASP.Net</title>
function isNumberKey(evt) {
  var charCode = (evt.which) ? evt.which : event.keyCode;
  if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
  return true;
}
<form id="form1" runat="server">
<input id="Text1" onkeypress="return isNumberKey(event)" type="text" />
    <asp:textbox id="TextBox2" onkeypress="return isNumberKey(event)" runat="server"></asp:textbox>
</form>
Numeric TextBox in ASP.Net Numeric TextBox in ASP.Net Reviewed by Bhaumik Patel on 8:30 PM Rating: 5