When using ASP.Net AJAX to perform a postback from within a textbox input control, I found that the textbox loses focus after the postback. To overcome this, I added the following code:
ScriptManager.GetCurrent(Me.Page).SetFocus(MyTextBox)
However, upon setting focus back to the textbox, the cursor lands at the beginning of the text in the control. To solve this, just add the following JavaScript on the page or within window.setTimeout:
var textInput = $get('MyTextBox');
if (textInput.createTextRange)
{
var range = textInput.createTextRange();
range.moveStart('character', (textInput.value.length));
range.collapse();
range.select();
}