RadTreeView node text highlight/selection

4 posts, 0 answers
  1. Richard Ness
    Richard Ness avatar
    1 posts
    Member since:
    Oct 2009

    Posted 02 Jun 2011 Link to this post

    I'm trying to figure out how to get the treeview to allow clean text selection of the text in the nodes and items inside node templates (labels etc). I have searched all over for a solution to this and it seems to be that different versions of RadTreeView allow this while others do not.

    For example here, you can highlight the text of the nodes and smaller parts of the text fine:
    http://mono.telerik.com/TreeView/Examples/Functionality/SingleExpandPath/DefaultCS.aspx

    Yet in this newer example, you can't:
    http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/expandanimation/defaultcs.aspx

    You can sometimes select the text if you start clicking far outside the node and drag, but there is no way to select sub parts of the node text.

    If anyone has any idea how to get text selection to work properly with TreeView please help!
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 08 Jun 2011 Link to this post

    Hi Richard,

    In the current implementation of the RadTreeView you are not allowed to make a text selection. This is set in our base styles and scripts.

    All the best,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Robin
    Robin avatar
    7 posts
    Member since:
    Sep 2014

    Posted 12 Jun 2015 in reply to Dimitar Terziev Link to this post

    Is this still an issue? Is there any way around it or to override the fact you cannot select text?

    My scenario is that I have products in a grid by category (represented by a tree control of categories). 

     I can't select my product display name or part number because the grid is in a tree node and I need that to be selectable.

     Any ideas?

    Robin

  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 17 Jun 2015 Link to this post

    Hi Robin,

    You could use the following code snippet in order to enable the text selection of the node text.
    <telerik:RadTreeView ID="RadTreeView1" runat="server">
        <Nodes>
            <telerik:RadTreeNode Text="Item1" runat="server"></telerik:RadTreeNode>
            <telerik:RadTreeNode Text="Item2" runat="server"></telerik:RadTreeNode>
            <telerik:RadTreeNode Text="Item3" runat="server"></telerik:RadTreeNode>
            <telerik:RadTreeNode Text="Item4" runat="server"></telerik:RadTreeNode>
        </Nodes>
    </telerik:RadTreeView>
     
    <script type="text/javascript">
     
        $telerik.$(function() {
            $telerik.$(".rtIn").on("selectstart", function(e) {
                e.stopPropagation();
            });
        });
     
    </script>


    Please note that this may interfere with the internal logic of the control.

    Regards,
    Dimitar Terziev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top