|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Does text box have "lost focus" event?Does text box have "lost focus" event?
For example, there are two text boxes, txtAccountNumber and txtName. Once user inputs account number into txtAccountNumber and move to txtName before inputing name, I want to fire a sub to verify this account number. Is it possible? The JavaScript event that occurs when a user leaves a TextBox is onblur. If
you want to do something server-side when the user leaves the Textbox, there are several choices. One would be to set the AutoPostBack property to True. However, note that setting the AutoPostBack property uses the onchange JavaScript event rather than onblur, which means that the postback will only occur if the TextBox's value has changed, so the server-side TextChanged event will be triggered as well. If you want the postback to occur when the user leaves the TextBox regardless of whether or not the value has changed, your best choice is to either manually add the onblur JavaScript event handler, or do this by writing a custom control that inherits TextBox. If you plan on having a lot of TextBoxes that postback when the user leaves them, I would suggest the latter. Hopefully this helps. "aspfun via DotNetMonster.com" <u53138@uwe> wrote in message news:a580c5b81287d@uwe...Show quoteHide quote > Does text box have "lost focus" event? > > For example, there are two text boxes, txtAccountNumber and txtName. Once > user inputs account number into txtAccountNumber and move to txtName > before > inputing name, I want to fire a sub to verify this account number. > > Is it possible? > > -- > Message posted via http://www.dotnetmonster.com > |
|||||||||||||||||||||||