Rad Tool Tip Manager And Each Rad Treenode

5 posts, 0 answers
  1. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 23 Sep 2012 Link to this post

    Hi, to simplify my requirement, I would say, I want to display the text of the RadTreeNode in the RadToolTipManager's tool tip

    Below is how my code looks currently:

    <telerik:RadTreeView ID="MainTree" runat="server" Skin="WebBlue" BackColor="white" EnableDragAndDrop="false" EnableDragAndDropBetweenNodes="false" Height="100%" OnLoad="LoadMainTree" Visible="true" OnContextMenuItemClick="ContextMenuItemClick">
    </telerik:RadTreeView>
    <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" OnAjaxUpdate="RadToolTipManager_AjaxUpdate" Skin="Sunset">
    </telerik:RadToolTipManager>

    RadToolTipManager_AjaxUpdate has following implementation in the code behind:

    internal static void RadToolTipManager_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
    {
        System.Web.UI.WebControls.Label lblTitle = new System.Web.UI.WebControls.Label();
        lblTitle.Text = "Title";
        lblTitle.Attributes.Add("style", "font-weight: 700");
        System.Web.UI.WebControls.Label lblCaption = new System.Web.UI.WebControls.Label();
        lblCaption.Text = "This is the the hard coded string but I want to print the text of the RadTreeNode, over which I hover my mouse...";
     
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(lblTitle);
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(lblCaption);
    }

    The LoadTree Event handler ...

    private void LoadTree()
            {
                        RadToolTipManager1.ShowDelay = 100;
                        RadToolTipManager1.HideDelay = 100;
                        RadToolTipManager1.AutoCloseDelay = 8000;
                        RadToolTipManager1.TargetControls.Add("MainTree");
            }

    Would you please do me a favor by posting codes for the server-side and/or client side, too ? So I can implement the most suitable of those.....

    I do not want to go the .ascx way, as demonstrated on the Demo page.

    Thanks,
    -Aarsh
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Sep 2012 Link to this post

    Hi Aarsh,

    One suggestion is that you can bind tooltip on NodeDataBound event of radtreeview as follows.

    C#:
    protected void MainTree_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
    {
       e.Node.ToolTip = e.Node.Text;
    }

    Hope this helps.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 24 Sep 2012 Link to this post

    You are right that did worked for me, but..... doesn't it show the default Windows tooltip rather the telerik tool tips ? Please correct me if I am wrong.

    A few more things, I am not actually populating the tree directly from the database, it actually is handled programatically

    Is there any way that we can send the ClientID of the node upon the hover client side event to the code behind & send it to the AJAX update method ?
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 25 Sep 2012 Link to this post

    Hello Aarsh,

    I advise that you examine the following online demo http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltiptreeview/defaultcs.aspx. It shows two ways to get RadToolTips and LOD on a RadTreeView. Note how each note needs an id attribute. In the demo it is a guid, but you can use its ClientID property or some other custom method. If you only need simple content you can use the AutoTooltipify feature of the RadToolTipManager after setting the ToolTip property of the nodes, or you can still use target controls as shown in this online demo.


    Greetings,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 26 Sep 2012 Link to this post

    http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-and-tooltip.aspx#2307150
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017