Label.AssociatedControlID Property
![]() |
---|
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience. |
Gets or sets the identifier for a server control that the Label control is associated with.
Assembly: System.Web (in System.Web.dll)
[TypeConverterAttribute(typeof(AssociatedControlConverter))] [ThemeableAttribute(false)] public virtual string AssociatedControlID { get; set; }
Property Value
Type: System.StringA string value corresponding to the ID for a server control contained in the Web form. The default is an empty string (""), indicating that the Label control is not associated with another server control.
Use the AssociatedControlID property to associate a Label control with another server control on a Web form. When a Label control is associated with another server control, its attributes can be used to extend the functionality of the associated control. You can use the Label control as a caption for another control, or you can set the tab index or hot key for an associated control.
When the AssociatedControlID property is set, the Label control renders as an HTML label element, with the for attribute set to the ID property of the associated control. You can set other attributes of the label element using the Label properties. For example, you can use the Text and AccessKey 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 ThemeableAttribute and ASP.NET Themes and Skins.
Available since 1.1
AccessKey
TabIndex
Label Class
System.Web.UI.WebControls Namespace
How to: Set Access Keys for ASP.NET Web Server Controls
Label Web Server Control Overview
How to: Use Label Web Server Controls as Captions
Walkthrough: Accessibility Guidelines for Using Image Controls, Menu Controls, and AutoPostBack
How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings