Finding and expanding node

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

    Posted 07 May 2015 Link to this post

    In our system we have a dynamic RedTreeView which is constructed on load and all nodes got a ID.

    I need the treeview to:

    • collapse all other nodes on click
    • find selected node by ID and expand it
    • find selected node by ID and expand it or simply only expand the selected node


    Collapsing the entire treeview is easy, but finding the node and expanding it seems to be a hassle.




  2. Ivan Danchev
    Ivan Danchev avatar
    837 posts

    Posted 08 May 2015 Link to this post


    You can achieve that by calling the RadTreeView's findNodeByAttribute() client-side method in the OnClientNodeClicked event handler, as shown in the code snippet below, where we expand the Node with custom attribute NodeID="RootNode2":
    <script type="text/javascript">
        function OnClientNodeClicked(sender, args) {
            var node = sender.findNodeByAttribute("NodeID", "RootNode2");
    <telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientNodeClicked="OnClientNodeClicked">
            <telerik:RadTreeNode Text="Mailbox - John Smith" NodeID="RootNode1">
                    <telerik:RadTreeNode Text="Calendar">
                    <telerik:RadTreeNode Text="Contacts">
            <telerik:RadTreeNode Text="Mailbox - Samuel Conners" NodeID="RootNode2">
                    <telerik:RadTreeNode Text="Calendar">
                    <telerik:RadTreeNode Text="Contacts">

    Ivan Danchev

    See What's Next in App Development. Register for TelerikNEXT.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top