Using the Label Control
Whenever you need to modify the text displayed in a page dynamically, you can use the Label
control. For example, the page in Listing 2.1 dynamically modifies the value of a Label
control’s Text
property to display the current time (see Figure 2.1).
Figure 2.1. Displaying the time with a Label
control.
Listing 2.1. ShowLabel.aspx
Any string that you assign to the Label
control’s Text
property is displayed by the Label
when the control is rendered. You can assign simple text to the Text
property, or you can assign HTML ...
Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.