using with AJAX tool:-
<asp:TextBox ID="txtContactNo" runat="server" class="textfield" MaxLength="10"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" ValidChars="0123456789"
TargetControlID="txtContactNo">
</cc1:FilteredTextBoxExtender>
or
using with JavaScript:-
<script type="text/javascript" language="javascript">
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
if (charCode == 8)
return true;
return true;
}
</script>
<asp:TextBox ID="txtContactNo" onkeypress="return isNumberKey(event)" runat="server" class="textfield" MaxLength="10"></asp:TextBox>