I have a web page with 3 textboxes. I want them to tab from the top one to the middle and then to the bottom one. I have tried acheiving this two ways.
Firstly in the properties pane I set the tab index to 0 for the first, 1 for the second and 2 for the last textbox. When I run the code the focus starts on the first textbox then it jumps to the address box of internet explorer itself and then to the third textbox and finally to second textbox. Not quite what I had in mind.
Secondly I tried putting this code in the Page_Load:
The results were the same as the first approach. I don't understand why this is happening.
Has anyone got any ideas please?
Thanks, Dave.
Firstly in the properties pane I set the tab index to 0 for the first, 1 for the second and 2 for the last textbox. When I run the code the focus starts on the first textbox then it jumps to the address box of internet explorer itself and then to the third textbox and finally to second textbox. Not quite what I had in mind.
Secondly I tried putting this code in the Page_Load:
Visual Basic:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TxtName.TabIndex = 0
TxtEmail.TabIndex = 1
txtMessage.TabIndex = 2
Dim strScript As String
strScript = "<script language=javascript> document.all('TxtName').focus() </script>"
RegisterStartupScript("focus", strScript)
End Sub
Has anyone got any ideas please?
Thanks, Dave.