This is a migrated thread and some comments may be shown as answers.

radtooltip for each node

2 Answers 67 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
beeta one
Top achievements
Rank 1
beeta one asked on 18 Oct 2012, 12:29 PM
hii,
how can i show a radtooltip for each node of radteeview..

thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Oct 2012, 12:35 PM
Hi Hash,

Following is the sample code that I tried to achieve your scenario.

ASPX:
<telerik:RadTreeView ID="RadTreeView1" runat="server" LoadingStatusPosition="BeforeNodeText">
   <Nodes>
         <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Root RadTreeNode1">
              <Nodes>
                 <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Child RadTreeNode 1">
                 </telerik:RadTreeNode>
              </Nodes>
         </telerik:RadTreeNode>
         <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Root RadTreeNode2">
              <Nodes>
                  <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Child RadTreeNode 2">
                  </telerik:RadTreeNode>
              </Nodes>
         </telerik:RadTreeNode>
    </Nodes>
    <CollapseAnimation Duration="100" Type="OutQuint" />
    <ExpandAnimation Duration="100" Type="OutQuart" />
</telerik:RadTreeView>
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" OnAjaxUpdate="RadToolTipManager1_AjaxUpdate">
</telerik:RadToolTipManager>

C#:
protected void Page_Load(object sender, EventArgs e)
    {
        RadTreeNode thirdNode = new RadTreeNode();
        thirdNode.Text = "Third Node";
        RadTreeView1.Nodes.Add(thirdNode);
        RadTreeNode firstNodeChild = new RadTreeNode();
        firstNodeChild.Text = "Child";
        RadTreeView1.Nodes[0].Nodes[0].Nodes.Add(firstNodeChild);
        AddTargetControls();
    }
protected void AddTargetControls()
    {
        foreach (RadTreeNode node in RadTreeView1.Nodes)
        {
            node.Attributes.Add("ID", node.Text);
            RadToolTipManager1.TargetControls.Add(node.Attributes["ID"], true);
            NodesInNode(node);
        }
    }
protected void NodesInNode(RadTreeNode startNode)
    {
        if (startNode.Nodes.Count > 0)
        {
            foreach (RadTreeNode node in startNode.Nodes)
            {
 
                node.Attributes.Add("ID", node.Text);
                RadToolTipManager1.TargetControls.Add(node.Attributes["ID"], true);
                NodesInNode(node);
            }
        }
    }
protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
    {
        Label text = new Label();
        text.Text = e.TargetControlID;
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(text);
    }

Hope this helps.

Regards,
Princy.
0
Aarsh
Top achievements
Rank 1
answered on 07 Nov 2012, 05:43 AM
Please see if this helps you out (you can jump directly to 'Solution' and can safely skip the previous contents on that post), if you want to dynamically implement the tooltip, different for each node.
Tags
TreeView
Asked by
beeta one
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Aarsh
Top achievements
Rank 1
Share this question
or