2
Vote

First TextBox focus on a DataForm

description

I have a page that contains a DataForm.
In that DataForm I have an EditTemplate that contains a DataField with a TextBox.
 
I want the focus to be set on that textbox when I navigate to that page.
 
If I manually call the Focus method on the TextBox control, I see it gets focus for one cursor 'blink' and then it's gone.
 
When debugging through the toolkit source code, I see that there is a "SetFocusToFirstFocusableControl" that could do the trick but it is not called because "_shouldMoveFocus" is set to false. The problem is that "_shouldMoveFocus" is set to true only in "OnBeginEditButtonClick" witch is only called when the user clicks the Edit button.
 
Maybe a solution would be to set "_shouldMoveFocus" to true in the BeginEdit method instead of "OnBeginEditButtonClick".
 
Olivier

comments