Introduction :
           Hi, In this Example i will Code you how to Make TextBox to Allow only numbers as a Input. Previously i have Explained How to Make Textbox Readoly , Here it allows only Numbers. Here i have used keypress event of the TextBox and, keycode for user to enter the input.  it usually used for float or decimal DataType.

Aspx and JavaScript :

<head runat="server">
<script type="text/javascript">
function NumbersOnly(key)
     var keycode = (key.which) ? key.which : key.keyCode;
     if (!(keycode == 8 || keycode == 46) && (keycode < 48 || keycode > 57))
            return false;
            return true;
<form id="form1" runat="server">
<asp:TextBox ID="txt1" runat="server" onpaste="return false;" onkeypress="return NumbersOnly(event);" ></asp:TextBox>