RadTooltip Not Formatting HTML for Treeview Node Image

3 posts, 0 answers
  1. Scott
    Scott avatar
    13 posts
    Member since:
    Dec 2008

    Posted 14 Sep 2009 Link to this post

    I am adding a RadTreeNode to a RadTooltipManager so that I can display formatted HTML text in the tooltip when someone hovers over the node.  This works fine as long as someone hovers over the node text.  But the RadToolTip doesn't display whenever someone hovers over the node image - instead it just displays a standard tooltip which does not format the HTML. 
    Any ideas on how to get the RadToolTip to display formatted HTML when someone hovers over the image would be greatly appreciated.


            protected void Button1_Click(object sender, EventArgs e)
               RadTreeNode tn1 = new RadTreeNode();
               tn1.ImageUrl = @"~\images\customer.PNG";
               tn1.Text = "test node";
               string htmlStr = @"<html>test1<br/>test2</html>";
               tn1.ToolTip = htmlStr;
               tn1.AllowDrop = false;
               tn1.Attributes["id"] = Guid.NewGuid().ToString();
               RadToolTipManager1.TargetControls.Add(tn1.Attributes["id"], true);


  2. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 17 Sep 2009 Link to this post

    Hello Scott,

    Thank you for the provided code, I examined it and I was able to reproduce the described behavior. This si teh exected behavior in such configuration if you examine the rendered HTML for the node. When you have set the ImageUrl property, the node is rendered as an IMG element which holds the image and a SPAN element which holds the text. However, when you add the ID attribute to the node, it is added as an attribute to the SPAN element and thus as a result you have only the SPAN added and tooltipified by the manager. What I can suggest is to use an ItemTemplate and put your own image there - in this manner you will be able to manipulate it on the server. If you use this approach you can even simply put a separate tooltip in the ItemTemplate instead of taking care for teh TargetControls collection, if this meets your requirements.

    I hoep that my explanation and suggest are helpful, let me know how it goes.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
  4. Scott
    Scott avatar
    13 posts
    Member since:
    Dec 2008

    Posted 17 Sep 2009 Link to this post

    Thanks for your help Svetlina.  I added both the image and text for the node in a nodetemplate and it works perfectly.

            <telerik:RadTreeView ID="RadTreeView1" Runat="server">
                <img src="Images/home.png" alt=""/>
                <asp:Label ID="lblText" runat="server"><%# DataBinder.Eval(Container, "Text") %></asp:Label>
                    <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1">

Back to Top