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

Rad Tool Tip Manager And Each Rad Treenode

4 Answers 110 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Aarsh
Top achievements
Rank 1
Aarsh asked on 23 Sep 2012, 10:01 PM
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

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Sep 2012, 07:30 AM
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.
0
Aarsh
Top achievements
Rank 1
answered on 24 Sep 2012, 12:31 PM
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 ?
0
Marin Bratanov
Telerik team
answered on 25 Sep 2012, 07:40 AM
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.
0
Aarsh
Top achievements
Rank 1
answered on 26 Sep 2012, 03:04 PM
http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-and-tooltip.aspx#2307150
Tags
ToolTip
Asked by
Aarsh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Aarsh
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or