set focus at end of text in textbox


T

ton

Hi,

I'm using Ajax to seach direct in a gridview. It works fine. I even keep the
focus on the input text box. Here is my code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
TextBox2.Attributes.Add("onKeyUp", "javascript:__doPostBack('" +
TextBox2.ID + "','')")
TextBox2.Focus() 'the initial focus in de load event of the page



and when firing the postback after the key up I got this function working:

Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
DbWebGrid2.ShowGrid(dbRecordNET.Session.dbTableNum.cTableClient, , ,
"where name like '%" & TextBox2.Text & "%'") 'shows the clients using the
filter
ScriptManager1.SetFocus(TextBox2) 'this keeps the focus, BUT ON THE
FIRST CHARACTER


End Sub
How can I keep the cursor to the end of the textbox, so user can keep on
typing to refine their search

thanks

Ton
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top