Hi
You add key press event in the code behind file as below
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("onkeypress", "javascript:return allownumbers(event);");
}
and write the Javascript function as below in the aspx page
function allownumbers(e)
{
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromCharCode(key);
var reg = new RegExp("[0-9.]")
if (key == 8)
{
keychar = String.fromCharCode(key);
}
if (key == 13)
{
key=8;
keychar = String.fromCharCode(key);
}
return reg.test(keychar);
}