how to set focus on a textbox at specific index
-
HI, I have a database driven chat room which refreshes after every 10 sec. If the user is typing some thing on the chat box teh page refreshes and focus is set to the start of chat textbox. i want to set the focus on teh right where the user is currently typoing e.g if page refreshes and he has already typed Hell, then focus should be after l, not from start. Thanks in advance..
-
HI, I have a database driven chat room which refreshes after every 10 sec. If the user is typing some thing on the chat box teh page refreshes and focus is set to the start of chat textbox. i want to set the focus on teh right where the user is currently typoing e.g if page refreshes and he has already typed Hell, then focus should be after l, not from start. Thanks in advance..
The standard technique for doing this is actually quite different. When you perform your refresh, you don't actually refresh everything on the page - what you do, instead, is refresh only certain parts of the screen. Using AJAX you retrieve the data you need and then you update the small areas of the screen that have changed. This leaves the textbox untouched, and the user can carry on without having focus flash around on them.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
HI, I have a database driven chat room which refreshes after every 10 sec. If the user is typing some thing on the chat box teh page refreshes and focus is set to the start of chat textbox. i want to set the focus on teh right where the user is currently typoing e.g if page refreshes and he has already typed Hell, then focus should be after l, not from start. Thanks in advance..
the best method to implement your application is not to postback page in every 10sec ... you'd better use ajax calls ... but if you want to do it after postback you shoud produce some scripts (javascript) code dynamically to focus on the previous control that user was using ...