Click here to Skip to main content
15,895,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello coders,
I 've two text boxes and an imagebutton in my aspx page. The button is coded in a way to enter a character in the textbox, but the problem is I dont know how to find which textbox the user has selected to enter . There is no onfocus event in asp!! please help me to fix this . Please.

Thanks and Regards,
Dark.
Posted
Updated 8-Apr-12 2:21am
v3
Comments
Mohamed Mitwalli 8-Apr-12 8:05am    
you mean you want to know which textbox has value ?
Stripelesstiger09 8-Apr-12 8:13am    
No, if thats the case I can use textchanged event right. I want to find which textbox the user has clicked on. The textbox with the cursor blinking .
Pablo Aliskevicius 8-Apr-12 8:43am    
You have onFocus and onBlur events in the client window, and you can handle them in JavaScript to set a property that would get submitted when your button is clicked. Would that help?
Stripelesstiger09 8-Apr-12 8:53am    
can you help me with the code. I'm new to aspx.

1 solution

There is an onfocus JavaScript event however this won't work for you since the textbox will loose focus and the button will receive the onfocus event when clicked.

You could handle the onBlur event of the textbox and set a variable indicating which textbox previously had focus, then read that variable in the button event.
 
Share this answer
 

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