For the textbox add this handler:
TextBox1.Attributes.Add("onkeydown", "JavaScript:return CheckifNumeric();");
Add this script:
function CheckifNumeric()
{
var retValue = false;
var mykey= (window.event.which) ? window.event.which : window.event.keyCode;
if ( ((mykey>= 48) && (mykey<= 57)) || (mykey== 8) || (mykey== 13) )
retValue = true;
if ( window.event.returnValue )
window.event.returnValue = retValue ;
return retValue ;
}
No comments:
Post a Comment