After every refresh the textbox scrolls back to top position

Posted by hareeshkumarkr-16190 under ASP.NET on 7/28/2012 | Points: 10 | Views : 1521 | Status : [Member] | Replies : 1

I have a chat application attached to my website where the user enters data from a textbox and user can view the replies from the other side using textbox with
multiline mode.But,The Problem is I had added the Multiline textbox inside an updatePanel with the Timer to refresh periodically.The problem arises here,After every refresh the textbox scrolls back to top position.The user cant view the recently recieved messages.
can,Any one suggests the way to overcome the problem?

Help me!


Posted by: Maneel on: 7/30/2012 [Member] Starter | Points: 25

While refreshing you can call any javascript means you can try like this once.
BY this the cursor position will be at the last of the text in textbox.....
if (obj.createTextRange) {

var FieldRange = obj.createTextRange();
FieldRange.moveStart('character', obj.value.length);

Here in this case obj means the textbox control and obj.value.length means total characters length in textbox. I hope it will be helpful if it is not the solution means please let me know.....

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response