Allow Only Numeric Values in Asp.Net Textbox Using JavaScript




    <html>
   <head>
   <script language="Javascript">
      
       function isNumOnly(evt) {
           var charCode = (evt.which) ? evt.which : event.keyCode
           if (charCode > 31 && (charCode < 48 || charCode > 57))
               return false;

           return true;
       }
  
   </script>
   </head>
   <body>
      <asp:TextBox ID="txtno" Text="" onkeydown="return isNumOnly(event)"  runat="server"></asp:TextBox>

   </body>
</html>

Comments

Popular posts from this blog

Display Canvasjs Line Chart using Data from Database

What are the SOLID principles, and why are they important

Write Text in Notepad files Using Asp.net