Represents the web navigation treelike control.
public class ASPxTreeView : ASPxHierarchicalDataWebControl, IRequiresLoadPostDataControl, IControlDesigner
Public Class ASPxTreeView Inherits ASPxHierarchicalDataWebControl Implements IRequiresLoadPostDataControl, IControlDesigner
Related API Members
The following members accept/return ASPxTreeView objects:
Add an ASPxTreeView control to your web application to provide it with the advanced navigation capabilities. This control allows you to display a hierarchical data as a tree.
The ASPxTreeView control supports the following common features:
- Data binding that allows the control’s nodes to be bound to hierarchal data sources.
- Programmatic access to the ASPxTreeView object model to dynamically create nodes, populate them with child nodes, set properties, and so on.
- Programmatic access to the ASPxTreeView client-side object model to perform specific client actions with nodes.
- An ability to perform round-trips to the server using the AJAX-based callback technology.
- Customizable appearance through themes, user-defined images, styles, and user-defined templates.
An ASPxTreeView control is made up of a tree of nodes represented by TreeViewNode objects. The parent node for all nodes, displayed within the ASPxTreeView is called the root node. This is a special node which isn’t displayed and can be accessed via the ASPxTreeView.RootNode property. The collection of its child nodes can be accessed via the ASPxTreeView.Nodes property. A node can have its own child nodes, that are stored in the parent node’s TreeViewNode.Nodes collection. This enables you to create a hierarchical structure of any complexity.
Each node of an ASPxTreeView control is capable of displaying any text specified by its TreeViewNode.Text property, a node image, which can be defined via the TreeViewNode.Image property, a check box, whose visibility is controlled by the ASPxTreeView.AllowCheckNodes and TreeViewNode.AllowCheck properties, and a tool tip text set via the TreeViewNode.ToolTip property.
The response of nodes to end-user clicks can be specified in two ways:
- Specify the TreeViewNode.NavigateUrl property of a node. In this instance, the browser will navigate to the specified linked page when a node is clicked. By default, a linked page is displayed in the same window or frame as the ASPxTreeView control. To display the linked content in a different window or frame, use the ASPxTreeView‘s ASPxTreeView.Target property (or the TreeViewNode.Target property for a particular node).
- Handle the ASPxTreeView.NodeClick event, in order to process them either on the server or client, depending upon the ASPxTreeView control’s ASPxTreeView.AutoPostBack property setting.
In order to control the clickable area of items, the ASPxTreeView.NodeLinkMode property can be used.
Nodes can be expanded/collapsed via the user interface (using expand buttons or double clicking nodes) or programmatically (see the TreeViewNode.Expanded property and the ASPxTreeView.CollapseAll, ASPxTreeView.ExpandAll, ASPxTreeView.ExpandToDepth, and ASPxTreeView.ExpandToNode methods) in order to show/hide their contents. The visibility of nodes can be controlled by the TreeViewNode.Visible property.
The look of the ASPxTreeView control’s default elements can be completely modified by creating a specific template, defining how an element will be rendered by a client browser. The ASPxTreeView control allows you to create templates for two element types: the node text content and the entire node content. You can apply templates for all identical elements within the ASPxTreeView (using control level templates) or for a particular element (using node level templates).
The ASPxTreeView control can be bound to a hierarchical data source by using its ASPxHierarchicalDataWebControl.DataSourceID or ASPxDataWebControlBase.DataSource property. Note that during data binding, specific ASPxTreeView.NodeDataBound events are generated, that allow you to dynamically map properties of the ASPxTreeView‘s nodes to the required bound data source’s data fields.
- The control’s client-side equivalent is represented by the ASPxClientTreeView object.
- On the client side, the client object can be accessed directly by the name specified via the ASPxTreeView.ClientInstanceName property.
- The available client events can be accessed by using the ASPxTreeView.ClientSideEvents property.