• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Focus Porblem using Tab Key and Tab+Shift Key in a Custom Control

I have created a custom control in visual studio 2005 containing/embedding two child button controls inside it, when i reference this control in my testing page and create two to three instances of that custom control it works well and custom controls are created, now when i use Tab Key from Keyboard to move focus between custom controls, it works well and focus shifts back and forth with Tab key Tab+Shif keys.
Now my problem is that i want when focus comes on some custom control then that custom control's first child control should get focus and selected and when again i press Tab key then it should shift to next custom control not to the second child control of that custom control whom first child control is selected. Also when the focus is on some custom control or some of its child control, when i press Shift+Tab key it should move to previous custom control and its first child control should be selected.
Please some body help me in this problem?
1 Solution
does setting TabIndex=X on the button controls solve the problem?  

If not, you will need to add complex custom javascript created at run time to set the tab order.
This code will capture the Shift+Tab Event both in Mozila / IE

<script LANGUAGE="JavaScript1.2">
function IEKeyCap(e)
    var evtobj=window.event? event : e
    var unicode=evtobj.keyCode? evtobj.keyCode : evtobj.charCode
    if (evtobj.altKey)
         if (unicode == 9)
           {alert('That\'s the Tab key')};


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now