asp.net - How to show tool tip on a Label

Display tooltip in a Label control
Label is an asp.net web server control that allow us to display texts on web pages. Label is a server control so we can customize the label's text programmatically such as displayed text, its color, font, background color, border color and style etc.

Label control's ToolTip property get or set the text displayed when the mouse pointer hovers over the Label web server control. ToolTip property value is System.String type and default value is String.Empty. Label tool tip is rendered nearly all web browsers properly. we can also set or change the Label control's ToolTip property value programmatically.

The following asp.net c# example code demonstrate us how can we display a tool tip in a Label server control.
LabelToolTip.aspx

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

<!DOCTYPE html>

<script runat="server">
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use tool tip (ToolTip) in Label</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">Label Example: ToolTip</h2>
        <asp:Label 
             ID="Label1" 
             runat="server"
             ForeColor="OrangeRed"
             BackColor="LightCyan"
             Font-Size="X-Large"
             Text="DodgerBlue"
             ToolTip="Color label"
             >
        </asp:Label>
        <br /><br />
        <asp:Label 
             ID="Label2" 
             runat="server"
             ForeColor="Snow"
             BackColor="DarkCyan"
             Font-Size="X-Large"
             Text="XmlDataSource"
             ToolTip="asp.net control"
             >
        </asp:Label>
    </div>
    </form>
</body>
</html>
More asp.net examples