step by step
given you have a textbox as following,
<asp:TextBox ID="TextBox13" runat="server"
onkeypress="return functionx(event)" >
</asp:TextBox>
you create a JavaScript function like this:
<script type = "text/javascript">
function functionx(evt)
{
if (evt.charCode > 31 && (evt.charCode < 48 || evt.charCode > 57))
{
alert("Allow Only Numbers");
return false;
}
}
</script>
the first part of the if-statement excludes the ASCII control chars, the or statements exclued anything, that is not a number