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

Event LostFocus of TextBox occurs after tab changing

1 Answer 253 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Richard Koslik
Top achievements
Rank 1
Richard Koslik asked on 21 Dec 2011, 01:28 PM
Hello,

I have a tabcontrol with 2 tabs. Now I want to check in the LostFocus of my TextBox on the second tab (sdk-Microsoft) if the input is valid or not and if it's not valid then I set the focus on the field again. This is working fine at every situation, except I click on the RadTabControl. There the tab is changed before I get the LostFocus of my TextBox, so I am not able to stop the user changing the tab.

best regards,
Richard Koslik

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 26 Dec 2011, 01:30 PM
Hi Richard Koslik ,

 If you need to prevent the Tab Selection in certain scenarios, have you considered using the PreviewSelectionChanged event of the RadTabControl. You can perform the validation you do in the LostFocus of the TextBox and set e.Handled to true in order to prevent the selection. Is this suitable for you?

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TabControl
Asked by
Richard Koslik
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or