Add this in Page_Load:TextBox1.Attributes["OnKeyPress"]="javascript:if(event.keyCode<48||event.keyCode>57)return false;";