Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a textbox that will take the employee number.
When the curser out (mouseout) from this textbox I want the name of this employee to appear in another textbox.

What can I do please?
Posted
Updated 29-Mar-11 6:56am
v2
Comments
Dalek Dave 29-Mar-11 12:56pm    
Edited for Grammar and Readability

You're using the wrong event for this. The correct choices would be either TextChanged or LostFocus. You just handle one of those events and kick off the code you need to to fill in the other TextBox.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Mar-11 10:32am    
My vote: "LostFocus"! 5+
Sergey Alexandrovich Kryukov 29-Mar-11 12:03pm    
Good advice. My 5.
--SA
Dalek Dave 29-Mar-11 12:56pm    
Spot on. Textchanged is the way to do it.
I always move the mous cursor out of the way when I'm entering text, so that's a bad design. You should only update other controls when the current control looses focus (or a button is pushed), so at that point, you'd need to handle either the LostFocus event, or the Leave event.
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 29-Mar-11 10:32am    
d'accord! 5+
Sergey Alexandrovich Kryukov 29-Mar-11 12:03pm    
Sure, you're right, the design is not acceptable. My 5.
--SA
You can use JavaScript to handle the mouseout event for the textbox then extract the value and populate the other textbox with it. JQuery will make some of this easier.
 
Share this answer
 
Comments
moon2011 29-Mar-11 10:01am    
thanks,
but what i need is loading employee data using c# function on the textchange of the textbox.
so can i call c# function in the javascript function
[no name] 29-Mar-11 10:18am    
How much of our time have you wasted by not stating what you really wanted in the first place?

There are plenty of examples of calling C# from JavaScript, look for them
Dalek Dave 29-Mar-11 12:57pm    
That works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900