Tree View

2 posts, 0 answers
  1. swarna priya
    swarna priya avatar
    3 posts
    Member since:
    May 2015

    Posted 18 May 2015 Link to this post

    HI,

     I wanted to expand all the child node of the parent node whenever the top node is selected. Please advice 

     

    thanks in advance

     

    Swarna

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 20 May 2015 Link to this post

    Hello Swarna,

    Please review the code in the following code snippet, which demonstrates how you can expand the clicked RadTreeView parent node and its child nodes:
    <script type="text/javascript">
        function OnClientNodeClicked(sender, eventArgs) {
            var parentNode = eventArgs.get_node();
            parentNode.expand();
            var allNodes = parentNode.get_allNodes();
            for (var i = 0; i < allNodes.length; i++) {
                var node = allNodes[i];
                node.expand();
            }
        }
    </script>
    <div>
        <telerik:RadTreeView ID="RadTreeView1" runat="server" EnableDragAndDrop="True" OnClientNodeClicked="OnClientNodeClicked"
            MultipleSelect="True" EnableDragAndDropBetweenNodes="True">
            <Nodes>
                <telerik:RadTreeNode runat="server" Text="Root1">
                    <Nodes>
                        <telerik:RadTreeNode runat="server" Text="Child 1.1">
                            <Nodes>
                                <telerik:RadTreeNode runat="server" Text="Child 1.1.1">
                                </telerik:RadTreeNode>
                                <telerik:RadTreeNode runat="server" Text="Child 1.1.2">
                                </telerik:RadTreeNode>
                            </Nodes>
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Child 1.2">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Child 1.3">
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
                <telerik:RadTreeNode runat="server" Text="Root2">
                    <Nodes>
                        <telerik:RadTreeNode runat="server" Text="Child 2.1">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Child 2.2">
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeView>
    </div>


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