Their is nothing as "
KeyPress" server side Event for Asp.Net TextBox. You may call your JavaScript function on
OnTextChanged
Event using
ClientScript.RegisterStartupScript
.
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
string eValue = "Something";
decimal decimalValue = 100;
ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "javascript:numbersonly(" + eValue + "," + decimalValue.ToString() + ")", true);
}
Have a look at below link for more information on
OnTextChanged
Event.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.textchanged.aspx