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
  [Collapse]Site Navigation and Layout
   [Expand]Product Information
   [Expand]Form Layout
   [Expand]Menu
   [Expand]Navigation Bar
   [Expand]Page Control and Tab Control
    Panel Overview
   [Expand]Ribbon
   [Expand]Site Map Control
   [Expand]Splitter
   [Expand]Tag Cloud Control
   [Expand]Title Index
   [Collapse]TreeView
     ASPxTreeView Overview
    [Collapse]Concepts
      Node
     [Collapse]Binding to Data
       Binding to Data Overview
       Data Binding Using Mapping Properties
       Automatic Data Binding
       Using Data Binding Events
      [Expand]Unbound Mode
       Virtual Mode
      Expanding and Collapsing Nodes
      Animation Effect
      Selection
      NodeLinkMode
      Check Box Support
      Callbacks
      Templates
    [Expand]Visual Elements
    [Expand]Examples
    [Expand]Member Tables
    [Expand]ASPxTreeView - Animated Images
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [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

Automatic Data Binding

The ASPxTreeView control has a unique built-in ability to automatically retrieve data from a data source that supports the IHierarchicalEnumerable or IHierarchicalDataSource interface. This topic describes the conditions that let ASPxTreeView control bind to data after just one property (ASPxHierarchicalDataWebControl.DataSourceID or ASPxDataWebControlBase.DataSource) is specified.

The ASPxTreeView can recognize the data items and retrieve some node characteristics from the data fields named in a specific way. If however, any of the data-related properties of an ASPxTreeView control (such as ASPxTreeView.TextField, ASPxTreeView.ImageUrlField, etc.) have been set, then the mapping of the associated TreeViewNode object properties will proceed according to Data Binding Using Mapping Properties.

Expanded Data fields and node properties name match

During binding, an ASPxTreeView control implements its automatic binding ability by retrieving node characteristics from those data fields whose names coincide with certain property names of a TreeViewNode object. The table below lists the names of the node object properties that can be mapped during automatic binding, and the matching data field names you should use in the data source for the mapping to work.

Node properties that can be set automatically Data field names
TreeViewNode.Checked Checked
TreeViewNode.Enabled Enabled
TreeViewNode.Image.Url ImageUrl
TreeViewNode.Name Name
TreeViewNode.NavigateUrl NavigateUrl
TreeViewNode.Target Target
TreeViewNode.Text Text
TreeViewNode.ToolTip ToolTip

The following image illustrates the process of data retrieval during automatic binding to a particular type of data source - XmlDataSource. Note, that only the DataSourceId property is set for the ASPxTreeView.

Expanded Binding to a Site Map

Since the properties of a System.Web.SiteMapNode object have specific names, the ASPxTreeView is designed to automatically bind to a Site Map source, with node attributes with similar names. In the process of binding, corresponding properties of individual TreeViewNode objects are automatically associated with these item attributes and mapped accordingly. See the table below for name correspondence.

Site Map node attributes Corresponding TreeViewNode object properties
System.Web.SiteMapNode.Description TreeViewNode.ToolTip
System.Web.SiteMapNode.Title TreeViewNode.Text
System.Web.SiteMapNode.Url TreeViewNode.NavigateUrl
Note

The structure of a Site Map allows flexibility in the naming of item attributes. After the ASPxTreeView detects the item attributes named title, url and description in the bound Site Map source, the conditions described in the above section apply.

ASPxTreeView control can bind to the Site Map via the SiteMapDataSource or the ASPxSiteMapDataSource control. The picture below demonstrates the process of data retrieval and TreeViewNode object property mapping, when binding via the ASPxSiteMapDataSource control.

Expanded See Also

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