Label control
The Label control provides you with a way to programmatically set text in an ASP.NET web page. You typically use the Label control when you want to change text in the page at run time, such as in response to a button click.
To add a Label control to a page
-
Drag the Label control from the Toolbox task pane to your page.
-
Set properties for the control in the Tag Properties task pane.
Common Label Properties
|
Property |
Description |
|---|---|
|
Text |
Specifies the text displayed in the label. In the user's browser, this is rendered as HTML. |
|
AssociatedControlID |
Specifies the ID of the control for which you want the Label control to be the caption. |
For a full description of all Label control properties, see Label Properties in the MSDN library.
The Label control provides one of several ways to display text in an ASP.NET web page.
Text display options
You can use the Label control to act as an active caption in front of a TextBox control or other control. Users can then press an access key to move to the control for which the Label control is the caption. For details, see How to: Use Label Web Server Controls as Captions in the MSDN library.