I need to run some code on server when user leaves the Textbox, it will do some calculations on what has been typed. I'd rather avoid doing it with jQuery, because it would involve creating a JSON server, etc.
Isn't there a way to do a postback for such an event?
Just call the code directly, no need to wait for an event: private void textBox1_Leave(object sender, EventArgs e) { mumble(); } private void someEvent() { textBox1. Text = SearchedText; mumble(); } void mumble() { // etc... } Just calling textBox1_Leave(this, EventArgs.
TextChanged is the default event handler created by VS2008 when you double-click a TextBox in Design view. This event handler is passed a standard EventArgs argument.
Remarks. The TextChanged event is raised when the content of the text box changes between posts to the server. The event is only raised if the text is changed by the user; the event is not raised if the text is changed programmatically.
The onblur event occurs when an object loses focus.
The TextBox has an AutoPostBack property to cause a postback when the user leaves the client-side textbox. There you can use the TextChanged event to call some serverside code.
What about the Textchanged Event
of the Textbox? It is fired when we input/change some text and then leave the textbox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With