title: ASP.NET UpdatePanel timer updated losing focus on textbox
body: <p>I have 2 UpdatePanels on my screen. One has a textbox in it and another is a gridview. I have a timer (outside of the UpdatePanel) that refreshes the gridview every 5 seconds. The UpdatePanel that has the textbox in it has a button (outside of the UpdatePanel) and when pressed what is entered in the textbox gets added to the DB and the textbox gets clear out, all via the UpdatePanel (ajax, no page loads).</p>
  
  <p>The issue I have is when the UpdatePanel that is linked to the timer and refreshing the gridview does it's thing it steals focus away from the textbox. I can give it focus by adding codebdehind "System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(this.txtNewComment);" but that places the cursor at the begining of the textbox. If I'm in the middle of typing something it screws up what I'm typing because the cursor is at the begining and not the end.</p>
  
  <p>Any ideas on how to keep the cursor exactly where it is in the textbox when the timer triggers the UpdatePanel?</p>
  
  <p>Normally you'd use the <code>Select()</code> function of the textbox as described here (<a href="http://msdn.microsoft.com/en-us/library/ms752349.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms752349.aspx</a>) but Select() doesn't seem to exist in ASP.NET for MS buttons.</p>