0

I am trying to set focus on a button of a modal window(that is opening a new page). The problem i am facing is if am using only the keyboard to navigate in the web page it is stopping at the maximize button and not coming back to the point where it started. Can you please tell me how to set index to a control? I have the following controls on the modal window. A label where text is dynamically filled. The number radio buttons are dynamically created There is a button to load the next page in the modal window.

So my question is how to set focus on this button and also keep the tab index rotating starting from the button through all the controls and again to the start, all within the modal window.

1 Answers1

1

First of all, welcome to Stackoverflow!

The solution for the focus issue, is pretty simple, where you should open the code-behind file of the dialog itself, and in the Page_Load event simply type:

buttonId.Foucs()

'buttonId' will be of course the id of your button.

Most of the controls have attribute called TabIndex, so you can add it to each input and determine the sequence when pressing tab key.

utsikko
  • 1,545
  • 1
  • 16
  • 27
  • Thanks for welcoming me and the response. I have been using the sharepoint 2010 modal window. I have been able to set focus on the button, but the earlier issue of the tab remains(tab index is set) the focus still get stuck at maximize and doesnt come back. Normally in a modal window pressing tab would mean the focus shifting from one control to another and coming back to where it was initially and this rotation of the focus happens on pressing the tab key. – pushpopped Aug 02 '12 at 14:54
  • I tried to reproduce the problem you described, both with the allowMaximize set to true, and once set to false, but couldn't. You can maybe try and set yours to false as well and see if it gets stuck somewhere else. – utsikko Aug 03 '12 at 06:28