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

Using Data Binding Events

The ASPxTreeView control implements specific data-binding events - ASPxTreeView.NodeDataBound and ASPxDataWebControlBase.DataBound. They allow you to perform custom operations at specific times in the data binding process.

The NodeDataBound event occurs immediately after an individual TreeViewNode object has been automatically created, and its properties have been initialized with values retrieved from the corresponding data fields. You can add functionality to your application within a handler of the NodeDataBound event, by accessing the data bound node via the event argument's TreeViewNodeEventArgs.Node property, and modify its settings, as required. Also, the TreeViewNode.DataItem property can be used to access the node's corresponding data item object, and any data field value can be obtained.

The DataBound event is invoked to notify you that any data binding logic used by the ASPxTreeView control has completed. This event occurs after all data items of the specified data source have been processed and the corresponding TreeViewNode objects have been added. You can also implement additional logic at this moment, by providing a handler to the DataBound event.

The following example demonstrates how the NodeDataBound event can be used.

In this code, the ASPxTreeView is bound to an XML file using a standard XmlDataSource component. The ASPxTreeView's TextField, ImageUrlField, and NavigateUrlField properties are used to specify the names of data item attributes from which the corresponding node settings should be obtained. The NodeDataBound event is handled to change the text style of nodes which represent classes (their text is displayed in bold).

The picture shows the view in a browser

Expanded See Also

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