I have a ASP.NET website where I have a login page. On this page I have 2 textboxes and a button. Now, when I open any browser, when I press the tab button it goes to my first textbox, second textbox and button. But after that it goes to any buttons a browser has. So for example, in IE it will go to the search bar, refresh button and home button before it gets back at textbox 1. Is it possible to prevent this?
Asked
Active
Viewed 57 times
0
-
there might be something in one of these answers that helps you - http://stackoverflow.com/questions/9526909/how-to-disable-tab-key-globally-except-for-all-forms-in-a-page-with-javascript – NDJ Jan 15 '14 at 15:34
-
I tried the solution that was accepted as a answer in the link that you provided me, worked until I reached my last control after that it does not return to my first control unfortunately. – Niek Jonkman Jan 15 '14 at 15:40
2 Answers
0
You can override ProcessCmdKey(ref Message msg, Keys keyData)
checking that keyData == Keys.Tab
.
Then move to the desired control following the one which currently has the focus :

Plue
- 1,739
- 1
- 18
- 22
0
Use the tabindex
html attribute. The number of that attribute should be the order that that element is in the tab cycle.
This is a plain HTML concept, although there is an ASP attribute that will map it to the HTML attribute, so you can use this for both HTML and ASP controls.

Servy
- 202,030
- 26
- 332
- 449