New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Managing Content

Content can be added to RadTooltip in multiple ways and is displayed in the below listed order of precedence. This means that if the first is not available the next one is tried until content is found.

  1. Setting the Text property:


    RadToolTip1.Text = "Clicking this link navigates to the Telerik web site";


    RadToolTip1.Text = "Clicking this link navigates to the Telerik web site"
  2. Content from the ToolTip property of the target control. It renders as the title HTML attribute. Images supply the AlternateText and alt properties in ASP.NET and HTML respectively.

    You can use the IgnoreAltAttribute to instruct RadToolTip to ignore the AlternateText and alt properties and not remove them from its target element. This will result in a change of the content source priorities for images and a second tooltip being shown under IE6 and IE7, as these browsers interpret the alt attribute like the title attribute.

    The following code snippet will show the AlternateText as a content in the tooltip, despite the existence of markup in the tooltip itself. You can set the IgnoreAltAttribute to true and see how the behavior changes:


    <asp:Image runat="server" ID="Image1" AlternateText="the alternate text" Width="100px" Height="100px" />
    <telerik:RadToolTip RenderMode="Lightweight" runat="server" ID="RadToolTip1" TargetControlID="Image1" IsClientID="false"
        ShowEvent="OnMouseOver" HideEvent="Default" Position="BottomRight" RelativeTo="Mouse"
        Width="100px" Height="50px" Title="title">
        <asp:Label ID="Label1" Text="text within the tooltip declaration" runat="server" />
  3. Content from the controls collection has the lowest priority. The content is supplied from whatever is specified between the opening and closing tags of the tooltip or set in Controls collections in the code behind.


    <telerik:RadToolTip RenderMode="Lightweight" ID="RadToolTip1" Skin="Inox" runat="server" TargetControlID="HyperLink1">
        Rich content:
        <asp:Button ID="btnA" runat="server" Text="Button in a ToolTip" />


        RadToolTip1.Controls.Add(new LiteralControl("Rich content:"));
        Button button = new Button(); 
        button.ID = "btnA";
        button.Text = "Button in a ToolTip";


        RadToolTip1.Controls.Add(New LiteralControl("Rich content:"))
        Dim button As New Button()
        button.ID = "btnA"
        button.Text = "Button in a ToolTip"

    You can also add large amounts of content dynamically using the RadToolTipManager OnAjaxUpdate event.

RadToolTip also exposes the server-side Title property, which can be used to set an overall title for the tooltip that is separate from the rest of the content. It is always displayed, regardless of the other content that is shown and the method that set it.

RadToolTip1.Text = "My Text"; 
RadToolTip1.Title = "My Title";
RadToolTip1.Text = "My Text"
RadToolTip1.Title = "My Title"

See Also

In this article