Allow Numbers Only Java Script Code

Add Script in .aspx
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
else
        return true;
}

Write in .cs Page Load
Txt_Number.Attributes.Add("onkeypress", "return isNumberKey(event);");

No comments:

Post a Comment