In aspx page add following script->
function maskBox(e)
{
var keynum = null;
if(window.event){
keynum = e.keyCode;
}
else if(e.which){
keynum = e.which;
}
if(keynum){
if(keynum==8 || keynum==9){return true;}
else
{return isInt(String.fromCharCode(keynum));
}
}
}
function isInt(test)
{
var ints = "0123456789";
if(ints.indexOf(test)>-1)
{
return true;
}
return false;
}
then in page load just add the following line
textBox1.Attributes.Add("OnKeyDown","return maskBox(event);");
No comments:
Post a Comment