- How to use associated control id in Label

AssociatedControlID in Label Server Control
Label is an web server control that display text on web page. label AssociatedControlID property get or set the identifier for a server control that the label control is associated with.

The AssociatedControlID property value type is System.String. this 'String' represents the ID of a server control in the web form. the default value of this property is empty string that means the label server control is not associated with any other server control.

By using this property we can extend the functionality of the associated control. we can use the label control as a caption for other control or we can set the tab index or hot key for an associated server control.

We can set the label AccessKey property to provide the hot key for associated control. we also can use the label Text property to set a caption for associated server control.

The following c# example code demonstrate us how can we use AssociatedControlID property of label server control in an application.

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

<html xmlns="">
<head id="Head1" runat="server">
    <title>How to use associated control id (AssociatedControlID) in Label</title>
    <form id="form1" runat="server">
        <h2 style="color:Navy">Label Example: AssociatedControlID</h2>
             Text="<u>U</u>ser Name"
             ToolTip="Color label"
More examples