Restrict user to enter non-numeric value in textbox using javascript:

<script type="text/javascript">

     function isNumberKey(evt) {

      var charCode = (evt.which) ? evt.which : event.keyCode;

       if (charCode >= 48 && charCode <= 57) {

         return true;

       }

       else {

         alert('number only');

         return false;

       }

    }

</script>

 

 

<asp:TextBox ID="TextBox2" runat="server"

 onkeypress="return isNumberKey(event)" ></asp:TextBox>