radtooltip for each node

3 posts, 0 answers
  1. beeta one
    beeta one avatar
    63 posts
    Member since:
    Aug 2012

    Posted 18 Oct 2012 Link to this post

    hii,
    how can i show a radtooltip for each node of radteeview..

    thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Oct 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 06 Nov 2012 Link to this post

    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.
Back to Top