Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Concepts
    [Expand]Binding to Data
    [Collapse]Data Representation Basics
     [Expand]Columns
     [Expand]Nodes
      Tree Generation Algorithm in the ASPxTreeList
    [Expand]Data Editing
    [Expand]Data Shaping and Manipulation
     Drag and Drop
    [Expand]Focus and Navigation
     Appearance Customization
     Save and Restore Layout
    [Expand]Templates
     Toolbars
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Tree Generation Algorithm in the ASPxTreeList

The ASPxTreeList is designed to answer the needs of all ASP.NET developers who face the challenge of rendering hierarchical data structures.

The nodes in a tree represent data source records. The Root node is a parent node for all nodes displayed within the ASPxTreeList. This is a special node which isn't displayed within the ASPxTreeList. The collection of its child nodes can be accessed via the ASPxTreeList.Nodes property. Nodes contained within this collection are displayed as root nodes within the ASPxTreeList.

To build a tree, a tree list's data source should contain two additional fields.

  • Key Field

    This field must contain unique values. This field must be assigned to the ASPxTreeList.KeyFieldName property.

  • Parent Field

    This field must contain values that indicate parent nodes, and the key values for the current node. It should be assigned to the ASPxTreeList.ParentFieldName property.

    By default, if this value doesn't point to any other node, the node is added to the ASPxTreeList.Nodes collection, as you see with the first node displayed in the image below. Otherwise, the node is added to its parent's TreeListNode.ChildNodes collection.

    However, if you specify the ASPxTreeList.RootValue property's value, only those nodes whose parent field value matches the ASPxTreeList.RootValue are added to the collection of root nodes. If the node's parent field value doesn't match the ASPxTreeList.RootValue and doesn't point to any other node, this node isn't displayed within the ASPxTreeList.

Important: the data types of the KeyField and ParentField fields must be the same.

 

The image below illustrates an example of an appropriate data source:

 

Expanded Concepts

Expanded Task-Based Help

How would you rate this topic?​​​​​​​