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

Radtreeview and tooltip

7 Answers 253 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
PÄR-OSKAR HOLMGREN asked on 05 Sep 2008, 07:19 AM
Hi

I'm letting a class inherit the treeview and populates it from a database, thus not having any control on the page where  the  treeview control is going to be displayed. My problem is  how to get any tooltip to be shown on mouseover since I cannot add the tooltip control to the ascx or aspx that use my control.  The tooltip for each node comes from a column in the database that is used to generate the content for the tree. Any ideas?

/Pelle Holmgren

7 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 05 Sep 2008, 07:31 AM
Hello PÄR-OSKAR HOLMGREN,

You can set different properties of the nodes during the NodeDataBound event.

I hope this helps.

Regards,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Aarsh
Top achievements
Rank 1
answered on 23 Sep 2012, 07:55 AM
Hello Veskoni,

I am having a similar issue where radtreenode.tool-tip works as expected and I can see the default, windows tool-tip. But I am more interested to use radtooltip manager. I fact, it works the simple way where I just am adding label controls and the same tool tip gets displayed for all the nodes.

I would rather prefer to build dynamic tool tip for each node. But can not figure out how can I do that

  1. I am programatically populating the tree and this all code is in a method
  2. I have to use ToolTipManager_AjaxUpdate(object sender, ToolTipUpdateEventArgs e) {} method

As we can see here the method for tool tip and the method for showing up the tool tip are different ... can not we use the other way then operating thru all those again ?

0
Marin Bratanov
Telerik team
answered on 26 Sep 2012, 11:31 AM
Hello Aarsh,

I have already answered several threads you posted with this question and I kindly ask that in the future you refrain from doing so. If you post only one thread but with all relevant information in it you will have better chances of receiving an accurate and helpful answer. Spreading the information among several threads only means people will need to review more posts and will be more likely to miss one.

You can find my answer in this post: http://www.telerik.com/community/forums/aspnet-ajax/tooltip/asp-net-treeview-and-radtooltip.aspx#2304162.


Kind regards,
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:06 PM
Dear, Marin Bratanov
I really appreciate you taking care of me -- I am not just saying, I really do :-) --  to the several posts of mine pointing to same issue. (yeah, I totally agree with you and will take care of this now onwards)

The demo, seemed to be using the acsx stuff and the user had clearly mentioned in the post that they can not use those, Hence I started my post with "I am having a similar issue where..."

In addition to that I also mentioned clearly in this post that "I do not want to go the .ascx way, as demonstrated on the Demo page." - didn't  this, too made any sense ?

But the thing is, you had the same answer all the times and that never could helped me :-( [ in a computer geeks' language: pointer to another pointer when the actual value is expected ] of those - I really wish I could explain in better way, I failed all the times, my bad.

Nevermind...

following are the similar posts:

http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-and-tooltip.aspx
http://www.telerik.com/community/forums/aspnet-ajax/tooltip/asp-net-treeview-and-radtooltip.aspx#2304162
http://www.telerik.com/community/forums/aspnet-ajax/tooltip/rad-tool-tip-manager-and-each-rad-treenode.aspx#2304157


Something really important

Solution:

For the tree where one needs to display the tooltip, add this to onclientmouseover

in my case this was the master page...

<telerik:RadTreeView *other attributes of my tree*  OnAjaxUpdate="RadToolTipManager_AjaxUpdate" 
onclientmouseover="Client_MouseOverTreeNode">
</telerik:RadTreeView>
 
<%--I had a hidden field, too. This I use to store the label/value of the node that we over the mouse on...--%>
 
<asp:HiddenField ID="radTreeNodeMouseOvered" runat="server" ClientIDMode="Static" />
Add JavaScript :

if yours is not the master page then put it the your usual place, mater page then it should be in the <asp:content>, other wise
 
<script type="text/javascript" id="telerikClientEvents4">
//<![CDATA[
 
    function Client_MouseOverTreeNode(sender,args)
    {
        var node = args.get_node();
        var activeNode = document.getElementById("radTreeNodeMouseOvered");
        if (node.get_text().indexOf(")") != -1)
        {
            activeNode.value = node.get_text();
            //alert("Mouse over node: " + activeNode.value);
        }
        else
        {
            activeNode.value = "";
        }
        var radToolTipManager = $find("<%= RadToolTipManager1.ClientID%>");
    }
//]]>
</script>

finally the AjaxUpdate event...

// I actually had to follow my specific requirement, and I took an advantage of that. (see the code bold fonts)
// In plain English: I am storing the value of the Mouse Over-ed node and forwarding it, you may have some better idea : )
// If you're having a different scenario you can just add the method with different name on the same page
 
// following code snippet is from my master page's code behind:
        protected void RadToolTipManager_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
        {
            //For next version
            <SomeNameSpace>.<SomeClass>.ToolTipManager_AjaxUpdate(sender, e, radTreeNodeMouseOvered.Value);
        }
 
// "<SomeNameSpace>.<SomeClass>" has following method implemented
internal static void ToolTipManager_AjaxUpdate(object sender, ToolTipUpdateEventArgs e, string nodeLabel)
        {
            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 = string.Empty;
            // my code handles the rest and yours should, too :-)
}

-----------------------

I pronounce this as the answer, please mark it as answer if it does the trick for you.


0
Marin Bratanov
Telerik team
answered on 27 Sep 2012, 02:57 PM
Hello Aarsh,

While this may be one way of achieving this I still strongly advise that you examine the online demo I previously linked: http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltiptreeview/defaultcs.aspx. The left treeview uses the  OnClientMouseOver and the RadTooltipManager's client-side API to invoke a tooltip. The Value of the tooltip is used internally instead of using a separate field (see the set_value() metod). The code-behind does not require that you use user control, you only need to add a control to the toolipt - it can be as complex as any user control, or as simple as a LiteralControl. The event arguments object exposes a field that holds the value passed from the cilent, so you can use it according to your custom logic.


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
Nicolaï
Top achievements
Rank 2
answered on 19 Mar 2013, 11:09 AM
Quick test only for http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltiptreeview/defaultcs.aspx... Got it working, but completely breaks down if you want to combine with treenode click events.
(Was planning to use this to add a minimal (icons only) radmenu when hovering nodes, in addition to the click event; would have looked nice..)
0
Boyan Dimitrov
Telerik team
answered on 22 Mar 2013, 07:37 AM
Hello,

Since the tool tip is designed for displaying additional information about the hovered item, I would recommend using our RadContextMenu for such scenario. This way you have the ability to show a context menu or popup menu for a a specific node and give the user ability to interact with the menu items.

I would like to encourage you to review our RadContextMenu online demo for detailed information.

Regards,
Boyan Dimitrov
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.
Tags
TreeView
Asked by
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Aarsh
Top achievements
Rank 1
Marin Bratanov
Telerik team
Nicolaï
Top achievements
Rank 2
Boyan Dimitrov
Telerik team
Share this question
or