I read a few threads that talk about how the address bar in IE is basically the first one that gets the focus when using TAB (this is what MSDN's own docs say).
However, I have seen situations where this does not always have to be so.
I have a main page and there is a formView inside my content area.
By default, the INSERT view is used and can never leave it (they can only be inserted without editing, and reading is processed elsewhere)
So, on my page, the page that I have is loading:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If fvwLogEntry.CurrentMode = FormViewMode.Insert = True Then 'Set the default field to position the cursor there...hopefully Dim FCtxtHrEmployeeId As TextBox FCtxtHrEmployeeId = CType(fvwLogEntry.FindControl("txtHrEmployeeId"), TextBox) Page.SetFocus(FCtxtHrEmployeeId.ClientID.ToString) End If
Now that this works, when the page loads, it sets the cursor to the employeeID text box inside the form's INSERT template.
HOWEVER, when I press TAB, it takes me to the address bar, and then, if I press tab again, it passes me through the rest of the elements on the page.
I set the tab index of the first element to 11, and then was added from there (I read that IE toolbars have index indices too, so I thought that maybe using more would get around them, but again, which is NOT REALLY doing because that it started from the lowest number anyway, but I gave him a chance to think that he would move forward, from where the focus was set.) If I click on the text box and then delete the TAB, it moves around the page as I would expect.
It is simple when the page loads and receives the focus set in the employeeID text box, which hits the tab, moves it to the address bar.
I also tried setting the other controls to -1 (those on which I did not want it to be nested), so far no luck.
So ... what can I do to get around this?
Should there be an easy way to set focus in the employeeID text box and make sure that pressing TAB after that will move to the next control in the form insert template and not jump to the address bar?