Radtreeview and tooltip

8 posts, 0 answers
  1. PÄR-OSKAR HOLMGREN
    PÄR-OSKAR HOLMGREN avatar
    8 posts
    Member since:
    Jun 2007

    Posted 05 Sep 2008 Link to this post

    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
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 05 Sep 2008 Link to this post

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

    Posted 23 Sep 2012 Link to this post

    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 ?

  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 26 Sep 2012 Link to this post

    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.
  6. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 26 Sep 2012 Link to this post

    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.


  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 27 Sep 2012 Link to this post

    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.
  8. Nicolaï
    Nicolaï avatar
    160 posts
    Member since:
    Apr 2008

    Posted 19 Mar 2013 Link to this post

    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..)
  9. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 22 Mar 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017