A newer version of this page is available. Switch to the current version.

Accessing Columns

The ASPxTreeList control stores its columns within the ASPxTreeList.Columns collection. To access only visible columns, use the ASPxTreeList.VisibleColumns property. Individual columns are represented by the TreeListDataColumn objects. A data column can be accessed by specifying its ID, caption or the name of the data source field to which it is bound.


using DevExpress.Web.ASPxTreeList;

// Accessing a column by specifying the name of the data source field to which it is bound.
TreeListDataColumn colDepartment = treeList.Columns["Department"] as TreeListDataColumn;
// Accessing a column by specifying its caption.
TreeListDataColumn colPhone = treeList.Columns["Primary Phone"] as TreeListDataColumn;
// Accessing a column by its index within the Columns collection.
TreeListDataColumn colFirstColumn = treeList.Columns[0] as TreeListDataColumn;

On the client, data columns can be accessed via the methods listed below:

The number of columns can be obtained via the ASPxClientTreeList.GetColumnCount method.