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

How to disable node selected on Parent node ?

1 Answer 466 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
VnDevil
Top achievements
Rank 2
VnDevil asked on 29 May 2010, 05:54 PM
Hi,

Please help me with the following issue:
I want to disable the selection on parent node in this code below

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DisableNodeSelected.aspx.cs" Inherits="Portal.Demo.RadControls.RadTreeView.DisableNodeSelected" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <telerik:RadTreeView ID="RadTreeView1" runat="server"
            <Nodes> 
                <telerik:RadTreeNode Text="Parent 1" Value="Parent 1" Selected="true"
                    <Nodes> 
                        <telerik:RadTreeNode Text="Child 01" Value="Child 01" /> 
                        <telerik:RadTreeNode Text="Child 02" Value="Child 02" /> 
                        <telerik:RadTreeNode Text="Child 03" Value="Child 03" /> 
                        <telerik:RadTreeNode Text="Child 04" Value="Child 04" /> 
                        <telerik:RadTreeNode Text="Child 05" Value="Child 05" /> 
                    </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode Text="Parent 2" Value="Parent 2"
                    <Nodes> 
                        <telerik:RadTreeNode Text="Child 01" Value="Child 01" /> 
                        <telerik:RadTreeNode Text="Child 02" Value="Child 02" /> 
                        <telerik:RadTreeNode Text="Child 03" Value="Child 03" /> 
                        <telerik:RadTreeNode Text="Child 04" Value="Child 04" /> 
                        <telerik:RadTreeNode Text="Child 05" Value="Child 05" /> 
                    </Nodes> 
                </telerik:RadTreeNode> 
            </Nodes> 
        </telerik:RadTreeView> 
    </div> 
    </form> 
</body> 
</html> 
 


1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 01 Jun 2010, 04:23 PM
Hi DA DA,

You can achieve this by simple JavaScript function, which is going to trap the ClientNodeClicked event over the TreeView, and then check if the clicked node is root and if it is - remove the selection from it (if this is the only thing that you want to prevent).

Here is reference for Client-side programming with RadTreeView in our help documentation that should help you with finding and using the methods in the client objects (tree, treeNode, treeNodeCollection): http://www.telerik.com/help/aspnet-ajax/tree_clientprogramming.html

Hope that this is going to help you!


Regards,
Nikolay Tsenkov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
VnDevil
Top achievements
Rank 2
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or