asp.net.ph

WebControl.TabIndex Property

System.Web.UI.WebControls Namespace   WebControl Class


Sets or retrieves the position of the control in the tabbing order for the current document.

Syntax


Inline <asp:control TabIndex = intIndex ... >
Script WebControl.TabIndex [ = intIndex ]

Property Value


intIndex Positive integer denoting the tab index.

This value must be a number between 0 and 32767. You can remove a control from the tab order, though, by setting TabIndex to -1.

This property is read/write with a default value of 0.

Remarks

TabIndex is used to specify or determine the tabbing order of elements on a Web Forms page.

Tabbing to a control sets focus to that control. The tabbing order defines the sequence in which controls will receive focus when navigated by the user via the keyboard. The tabbing order may include controls nested within other controls.

When a page is initially loaded, the first item that receives focus when the Tab key is pressed is the addess bar. Next, tab selection order is determined by the value of TabIndex as follows:

  • All objects with a TabIndex greater than 0 are selected in ascending tab index order, or in source order for duplicate tab index values.
  • All objects with a TabIndex equal to 0, or without TabIndex set, are selected next, in source order.
  • Elements that are disabled, or with TabIndex set to -1, are omitted from the tabbing order.

The actual key sequence that causes tabbing navigation or element activation depends on the configuration of the user agent, but in general, the Tab key is used.

User agents may also define key sequences to navigate the tabbing order in reverse, such as Shift+Tab. When the end ( or beginning ) of the tabbing order is reached, user agents usually loop back to the beginning ( or end ).

This feature requires Microsoft® Internet Explorer® 4 and later.

Example

The following example shows how to declaratively set the TabIndex property of a Web control at design time.

<asp:textbox id = "myTextBox" tabindex=1 runat = "server" />

The example below shows how to programmatically set the TabIndex property at run time, depending on user input. Note that when multiple controls share the same TabIndex, the sequence follows the order in which the elements appear in the HTML source.

 Show me 

See Also

WebControl Members   Base Web Control Properties Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph