asp.net.ph

WebControl.AccessKey Property

System.Web.UI.WebControls Namespace   WebControl Class


Sets or retrieves the keyboard shortcut key for accessing a Web control.

Syntax


Inline <asp:control accesskey = strKey ... >
Script WebControl.AccessKey [ = strKey ]

Property Value


strKey Character string that denotes an alphanumeric keyboard key.

This property is read/write and returns an empty string if not set.

Remarks

AccessKey is used to specify the keyboard shortcut for quickly navigating to a Web server control. The designated access key can be any single letter or number from the document character set.

The input method of access keys depends on the underlying system. On machines running MS Windows®, one generally has to press the ALT key in addition to the access key. On Macintosh® systems, one generally has to press the CMD key in addition to the access key.

By default, invoking the AccessKey sets focus to the object. The action that occurs when an object receives focus depends on the object. For instance, when a user activates a text field, it allows input. When a user activates a dropdown list, the browser positions the selector at the first item in the list, and so on.

In addition, some controls perform an action after receiving focus. For example, using AccessKey on a checkbox or radiobutton fires the onCheckedChanged event and toggles the Checked property, visibly selecting or deselecting the control. Using AccessKey on a button fires the onClick event and triggers any action associated with the event.

Authors are advised to include markup syntax in the label associated with the control ( such as by underlining the specified key value ), to easily distinguish it from other characters and thus emphasize its role.

This feature requires Microsoft® Internet Explorer® 4.0 or later.

Example

The following example shows the results of setting and using the AccessKey property for different types of Web controls. Notice that in the case of buttons, invoking the access key in effect "clicks" the control.

 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