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

RadTreeView node text highlight/selection

3 Answers 252 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Richard Ness
Top achievements
Rank 1
Richard Ness asked on 02 Jun 2011, 10:53 PM
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!

3 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 08 Jun 2011, 09:20 AM
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.

0
Robin
Top achievements
Rank 1
answered on 12 Jun 2015, 06:59 PM

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

0
Dimitar Terziev
Telerik team
answered on 17 Jun 2015, 06:24 AM
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
Tags
TreeView
Asked by
Richard Ness
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Robin
Top achievements
Rank 1
Share this question
or