Monday, September 12, 2011

Allow only Numerics using JQuery in ASP.Net

Hi friends...Today i am going to explain the topic "Allow only Numerics using JQuery in ASP.Net".Our Requirement is, we have textbox which must be allow only entering numerics(Numbers). There are many ways to implement this.But have a look at to implement this by using JQuery.
For this you must include the Javascript Code in section of your Web Form.
Head Section




Body Section



Example :


Explaination:
Assume that in your web form there is a textbox that can be accessed only the numerical values. Just include the "onkeypress="AllowDigitsOnly()" to the Textbox. Whenever you press a key using Keyboard then automatically fires the event in the textbox called onkeypress event.
For that event you assigned the function "AllowDigitsOnly()".The function Definition must be written in script block in head section of your
Web Form.
That's it Friends
Allow Numerics to the TextBox is ready to use.


Thanks
V BhaskarReddy Kovvuri

Labels: , , , , ,

2 Comments:

At September 15, 2011 at 9:16 AM , Anonymous Anonymous said...

Good Post..Nice tip

 
At September 18, 2011 at 6:40 PM , Anonymous Anonymous said...

good work
Thanks

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home