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

Telerik 'RadTreeView' equivalent for ASP.NET 'TreeView'

1 Answer 83 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Xorv
Top achievements
Rank 2
Xorv asked on 10 Jan 2012, 07:32 AM
Hi Admin,

For the follwing code (asp.net Treeview), please give the telerik equivalent.

 

 

 

 

foreach (DataRow row in territories.Tables[0].Rows)
            {
                RadTreeNode newNode = new RadTreeNode(row["terr_rpt_grp_ttl"].ToString(), row["terr_rpt_grp"].ToString());
                newNode.PopulateOnDemand = true;
                newNode.SelectAction = TreeNodeSelectAction.Expand;
                node.ChildNodes.Add(newNode);
            }
        }

 

The markup defined for the asp.net TreeView is:-

<asp:TreeView Runat="Server" OnTreeNodePopulate="Node_Populate" ID="tvwauthors">
 
<Nodes>
 
<asp:TreeNode Text="ALL" PopulateOnDemand= "true" Value="0"/>
 
</Nodes>
 
</asp:TreeView>

  Please help regarding this. Just the telerik equivalent. (For ex. PopulateOnDemand, TreeNodeSelectionAction.Expand etc etc)

Thanks a lot
XORV

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Jan 2012, 08:14 AM
Hello,

You can easily customize the action when clicking the node, by attaching the 'OnClientNodeClicked' event to RadTreeView instead of SelectAction. For example the following client code shows how to expand/collapse the node when clicking the node.

JS:
function OnClientNodeClicked(sender, args)
  
   args.get_node().set_expanded(!args.get_node().get_expanded()); 
  }

Telerik RadTreeView supports "Load-On-Demand" feature that allows child nodes to be added on the fly as parent nodes are expanded.
Load On Demand Overview
Server-Side Load On Demand

Thanks,
Princy.
Tags
TreeView
Asked by
Xorv
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or