Skip to main content

Creating Columns and Binding Them to Data Fields

  • 2 minutes to read

When the ASPxTreeList is bound to a data source, you need to create columns and bind them to data fields. There are two ways to add columns and bind them to fields:

 

Creating and Binding Columns at Design Time

Once you have bound the ASPxTreeList to a data source, it automatically creates data columns for all data source fields and switches the ASPxTreeList.AutoGenerateColumns option off. To access the columns collection, invoke the Columns edit form.

cdAccessingColumns

This form allows you to add, delete, access and customize column settings, and perform other common collection management tasks.

 

Creating and Binding Columns at Runtime

The example below creates a data column, and adds it to the ASPxTreeList’s columns collection:

using DevExpress.Web.ASPxTreeList;

TreeListDataColumn colPhone = new TreeListDataColumn("Phone", "Primary Phone");
ASPxTreeList1.Columns.Add(colPhone);