How to: Use Label Web Server Controls as Captions
You can use theWeb server control to act as an active caption in front of another Web server control, such as a control. The Label control cannot receive the user input focus. However, by associating the Label control with another control, users can navigate to the associated control by simultaneously pressing the ALT key with an access key that you define for the Label control.
To use a Label Web server control as a caption
Set the Label control'sproperty to the ID of the control for which you want the Label control to be the caption.
Set the Label control'sproperty to a single letter or number to define an access key
If you associate the Label control with a button, when users simultaneously press the ALT key with the access key for the Label control, the button is clicked.
Optionally, set theproperty of the Label control to display an underlined character that indicates the access key.
The following example shows how to use a Label control as a caption for a TextBox control. When the page renders, users will be able to press ALT+N to navigate to the text box. The letter N in the Label is underlined.
<asp:Label AccessKey="N" AssociatedControlID="TextBox1" ID="Label1" runat="server" Text="<u>N</u>ame:"> </asp:Label> <asp:TextBox ID="TextBox1" runat="server" />