System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.WebControls.WebControl System.Web.UI.ITextControl System.Web.UI.ControlValueProperty("Text", null) System.Web.UI.ToolboxData("<{0}:Label runat="server" Text="Label"></{0}:Label>") System.Web.UI.ParseChildren(false) System.ComponentModel.Designer("System.Web.UI.Design.WebControls.LabelDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.ComponentModel.DefaultProperty("Text") System.Web.UI.DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.LabelControlBuilder))

In this topic:

Introduction

Accessibility

Declarative Syntax

## Introduction

Use the control to display text in a set location on the page. Unlike static text, you can customize the displayed text through the property.

You can also use the and controls to display text on the Web Forms page. However, unlike the control, these controls do not render any additional tags.

This control can be used to display user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

## Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

## Declarative Syntax

`<asp:Label AccessKey="string" AssociatedControlID="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" Height="size" ID="string" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" Text="string" ToolTip="string" Visible="True|False" Width="size" />`

Represents a label control, which displays text on a Web page.

- Constructor

  Use this constructor to create and initialize a new instance of the class.

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  1.0.5000.0
  2.0.0.0
  System.Void ``

  The method is used primarily by control developers to insert the additional attributes and styles to the output stream for a control.

  The method for a control determines whether the for attribute should be added with the value, and if the inline-block style should be applied to display the border style and width.

  Adds the HTML attributes and styles of a control to render to the specified output stream.

  An that represents the output stream to render HTML content on the client.
- Method
  System.Void ``

  The method is used primarily by control developers when deriving a custom control from the class.

  If the input object is a , and the control has no child controls, the input object is used to set the property of the control. Otherwise, the method of the base class is called and the specified object is added to the collection.

  Notifies the control that an element was parsed and adds the element to the control.

  An object that represents the parsed element. 1.0.5000.0 2.0.0.0
- Property
  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.Web.UI.Themeable(false)
  System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.AssociatedControlConverter))
  System.Web.UI.IDReferenceProperty(typeof(System.Web.UI.Control))
  System.String To be added.

  Use the property to associate a control with another server control on a Web form. When a control is associated with another server control, its attributes can be used to extend the functionality of the associated control. You can use the control as a caption for another control, or you can set the tab index or hot key for an associated control.

  When the property is set, the control renders as an HTML label element, with the for attribute set to the property of the associated control. You can set other attributes of the label element using the properties. For example, you can use the and properties to provide the caption and hot key for an associated control.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the identifier for a server control that the control is associated with.

- Method
  System.Void ``

  This method is used primarily by the .NET Framework infrastructure and is not intended to be used directly from your code. However, control developers can override this method to specify how a custom server control restores its view state. For more information, see ASP.NET State Management Overview.

  The method restores view-state information for the control from a previous page request that was saved by the method.

  Loads the previously saved state for the control.

  An object that contains the saved view state values for the control. 1.0.5000.0 2.0.0.0
- Method
  System.Void `` To be added

  Renders the contents of the into the specified writer.

  The output stream that renders HTML content to the client. 1.0.5000.0 2.0.0.0
- Property
  1.0.5000.0
  2.0.0.0
  System.Web.UI.HtmlTextWriterTag To be added.

  Use the property to determine the value that is associated with a control. The property is used primarily by control developers.

  Gets the HTML tag that is used to render the control.

- Property
  System.String The text displayed in the label.

  Use the property to specify or determine the text content of the control. This property is commonly used to programmatically customize the text that is displayed in the control.

  The property can include HTML. If it does, the HTML will be passed unchanged to the browser, where is might be interpreted as markup and not as text. If you want the browser to display HTML markup as plain text, you can use the method, as shown in the example for the class overview. You can also use the control instead of the control, and set the property to .

  Setting the property will clear any other controls contained in the control.

  This control can be used to display user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  This property is the default property that a object binds to at run time. For more information, see , , and Using Parameters with Data Source Controls.

  Gets or sets the text content of the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Localizable(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Bindable(true)