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

Unable to perform operation on the item is locked in workspace

Maximum Stored Procedure Function Trigger or View Nesting Level Exceeded (limit 32) in SQL Server

Insecure cookie setting: missing Secure flag