Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a OnExit or Leave event on ASP.NET textbox?

Tags:

c#

asp.net

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?

like image 691
Adriano Carneiro Avatar asked Apr 21 '11 22:04

Adriano Carneiro


People also ask

How to call TextBox leave event in c#?

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.

Which is the default event of TextBox control in asp net?

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.

What is the event of TextBox?

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.

What is Onblur event of TextBox in asp net?

The onblur event occurs when an object loses focus.


2 Answers

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.

like image 77
Hans Kesting Avatar answered Oct 19 '22 03:10

Hans Kesting


What about the Textchanged Event of the Textbox? It is fired when we input/change some text and then leave the textbox.

like image 39
Muhammad Akhtar Avatar answered Oct 19 '22 01:10

Muhammad Akhtar