Monday, January 18, 2016

Allow only numbers and dots in a text Box


Add the following java script to onkeypress event.

[code] <asp:TextBox ID="txtPrice" runat="server" onkeypress="return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf('.')<0?event.keyCode==46:false)"></asp:TextBox> [/code]