Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

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

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. :D

Posted

I don't know about this Dave, but it seems like it was going backwards.... maybe try

 

[CS]

TxtName.TabIndex = 2

TxtEmail.TabIndex = 1

txtMessage.TabIndex = 0

[/CS]

 

Might possibly work? Sorry for my lack of knowledge in this area, just gave my observations...

-Sean
Posted

Thanks for that coldfusion244.

 

Unfortunately it does exactly the same.

 

Up to now the only way to the tab order I want is to create the forms components in the order you wish them to tab in.

 

There must be a way of doing it other than that though?

 

Thanks again, Dave. :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...