Write this in the HTML Part
Please Inculde the JavaScript Tag and place the below function in it.
function fnAllowNumeric()
{
if (event.keyCode < 48 || event.keyCode > 57 ) event.returnValue = false;
}
Close the Script Tag.
Write this in the CodeBehind Part
and in the Page_Load write like this
Page_Load
{
this.txtNumeric.Attributes["OnKeyPress"] = "Javascript:return fnAllowNumeric()";
}
Saturday, July 28, 2007
JavaScript to Allow Only Numbers in a TextBox
Posted by
Rutts
at
1:11 PM
Labels: Java Scripts
Subscribe to:
Post Comments (Atom)


0 comments:
Post a Comment