Free Trial Buy Now

TreeView - Data Binding to XML

Description

This demo illustrates how the BindToXML method can be used to populate the DevExpress MVC TreeView with node information taken from an xml file. The source XML file contains hierarchical information about a set of classes and their members (properties, methods, events).

The MVC TreeView ships with the following data binding methods:

  • Bind(object dataObject);
  • BindToSiteMap(string fileName);
  • BindToSiteMap(string fileName, bool showStartingNode);
  • BindToXML(string fileName);
  • BindToXML(string fileName, string xPath);
  • BindToXML(string fileName, string xPath, string transformFileName);

TreeView implements specific properties that point to the data fields containing necessary data. These are the TextField, ImageUrlField, NavigateUrlField, NameField and ToolTipField properties. If these properties are not defined, the TreeView is able to automatically bind to data fields whose names coincide with property names of a MVCxTreeViewNode object (such as the Text, ImageUrl, NavigateUrl, Name and ToolTip).

In this demo, the TextField, ImageUrlField, and NavigateUrlField properties are used to specify the names of data item attributes from which corresponding node settings are obtained. The NodeDataBound property is used to define a delegated method, changing the text style of nodes which represent classes (text is displayed in bold).

Version: v2012 vol 2.8
Experience the DevExpress Difference Today
Demos with source code are included with an installation of DevExpress controls for ASP.NET. Refer to the Demos and Sample Applications topic to learn more.
To download your free evaluation copy of our award-winning ASP.NET libraries, visit the Downloads page
All DevExpress MVC Extensions ship as part of DXperience ASP.NET, Enterprise, and Universal.
To obtain pricing information, visit the Pricing Options page or contact us via Email at info@devexpress.com
or by telephone at +1 (818) 844-3383 between 8:30am and 5pm Pacific Time.