This is a migrated thread and some comments may be shown as answers.

Keeping focus question

3 Answers 86 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Mike Dennis
Top achievements
Rank 1
Mike Dennis asked on 20 Apr 2009, 05:27 PM
I have a FormView with a lot of TextBoxes that AutoPostBack and perform an update on the OnTextChanged event.~26nbsp~3b I~27m using the RadAjaxManager on this FormView~2c and I was wondering if there is a way to keep the focus on the current TextBox that has been clicked on or tabbed to.~26nbsp~3b That isn~27t the box firing the event~2c but the box that the user is at right when the loading message gets displayed.~3cbr /~3e

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 23 Apr 2009, 10:33 AM
Hello Mike Dennis,

You can get a reference to the text box in code behind and use the ScriptManager's SetFocus method:

ScriptManager.GetCurrent(this.Page).SetFocus(currentTextBox); 

I hope this helps.

Greetings,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mike Dennis
Top achievements
Rank 1
answered on 27 Apr 2009, 05:58 PM
Is there a way to get what control currently has focus during the OnTextChanged event~3f~26nbsp~3b There are a lot of text boxes~2c and the user could click any of them~2c so i would need to know which control has focus so that I can use it to set focus later.~3cbr /~3e
0
Accepted
Tsvetoslav
Telerik team
answered on 30 Apr 2009, 08:06 AM
Hi Mike Dennis,

You need to get on the client the ID of the textbox that received the focus before the postback and use it when the page loads to set the focus to this control. How exactly this should be done depends on your particular implementation.

Please, review the attached sample for some helpful suggestions in this direction.

Best Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
Mike Dennis
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Mike Dennis
Top achievements
Rank 1
Share this question
or