DotNet Solution

  • Home
  • Asp.net
    • Controls
    • DataControl
    • Ajax
  • Web Design
    • Html
    • Css
    • Java Script
  • Sql
    • Queries
    • Function
    • Stored Procedures
  • MVC
    • OverView
    • Create First Application
  • BootStrap
    • Collapse Function

Wednesday, 20 July 2016

Numeric Value Validation Through JavaScript

  Unknown       06:15       Js       No comments    

Validate Only Numeric Value Enter In TextBox Using JavaScript function
Firstly Write Java Script Function in <head tag> in Asp.Net
After That Call Function <OnKeyPress > on TextBox
Ex.
<head>
<script type="text/javascript">
   var specialKeys = new Array();
   specialKeys.push(8); //Backspace
        function IsNumeric(e)
         {
                  var keyCode = e.which ? e.which : e.keyCode
                   var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1);
                   document.getElementById("error").style.display = ret ? "none" : "inline";
                    return ret;
          }
</script>
</head>

Call On TextBox
ex.
<table>
<tr>
<td> Employee Salary<td>
<td>:</td>
<td>
  <asp:TextBox ID="tbnEmpSalary" runat="server" MaxLength="12" onkeypress="return IsNumeric(event)"></asp:TextBox>
     <span id="error">* Input digits (0 - 9)</span>
</td>
</tr>
</table>

OutPut
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Email This BlogThis! Share to X Share to Facebook
Newer Post Older Post Home

0 comments :

Post a Comment

Popular Posts

  • Auto Increment Id in Sql Server
    SQL server identity column values use in table Steps- Firstly Open-> Sql Server Create Table -> First Field Like ID Usually Autoi...
  • Numeric Value Validation Through JavaScript
    Validate Only Numeric Value Enter In TextBox Using JavaScript function Firstly Write Java Script Function in <head tag> in Asp.Net ...
  • Asp.net- MultiView
    MultiView and View controls allow you to divide the content of a page into different groups, displaying only one group at a time. Each Vie...
  • Reset Identity Column in Sql Server
    We Want To Reset Identity Column Then Use Code.If We Delete column By Id Like We delete 5 no id and After Than we Insert New then We get 6...
  • Email Validation In JavaScript
    We use Validation for Email  in Javascript like in above example <!DOCTYPE html> <html> <head> <script> fu...
  • Javascript Regular Expression Email Validate
    Validate Email using Regular Expression In JavaScript- 1. Create Input type Text box and and onclick cal  checkemail function of Javascr...
  • Collapse Function Use in Bootstrap.
    Defination  1.  Collapse Means suddenly fall down. 2.  Just add data-toggle="collapse" and a data-target to element to ...
  • Table Structure Acces in Database
    Table Structure Get From  Database in Sql Server If We Want To get Any  Table Structure from Database . Show How Many Column Created and...
  • Open First Application in MVC
    How To Create First Application in MVC.Follows Some Steps-    STEP 1 . Firstly Go Start menu in Computer And Click on Installed Visual s...
  • Whats is Jquery
    What is jquery jQuery is a lightweight  JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your w...

Blog Archive

  • ▼  2016 ( 36 )
    • ►  February ( 1 )
    • ►  March ( 5 )
    • ►  April ( 1 )
    • ►  June ( 10 )
    • ▼  July ( 6 )
      • Asp.net- MultiView
      • Reset Identity Column in Sql Server
      • Count Number Of Word In Sql Server
      • Values Enter With SplitFunction in Sql Server
      • Split Function in Sql Serever
      • Numeric Value Validation Through JavaScript
    • ►  November ( 8 )
    • ►  December ( 5 )
  • ►  2017 ( 1 )
    • ►  January ( 1 )
Powered by Blogger.

Categories

  • Ajax
  • AllFunction
  • Controls
  • CreateApplication
  • css
  • Function
  • javascript
  • Js
  • over view
  • OverView
  • Queries
  • StoredProcedures

Text Widget

Sample Text

Pages

  • Home

Copyright © DotNet Solution | Powered by Blogger
Design by Vibha Acharya