<script type = "text/javascript">
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
Call the isNumberKey(event) function on keypress event of the textbox like this:
<asp:TextBox id="txtQty" runat="server" onkeypress="return isNumberKey(event);"/>
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
Call the isNumberKey(event) function on keypress event of the textbox like this:
<asp:TextBox id="txtQty" runat="server" onkeypress="return isNumberKey(event);"/>