This demo illustrates how to bind TreeList columns to Model fields using lambda expressions.

To enable binding TreeList columns to Model fields using lambdas, it is required to declare the TreeList extension using the ExtensionsFactory.TreeList<RowType> strongly-typed declaration method. This method accepts the TreeListSettings<RowType>object that implements the following specific strongly-typed members.

KeyField. This method defines a key field. In this demo, the key field name is defined using the lambda expression passed as a parameter to the KeyField method.

ParentField. This method defines a parent field. In this demo, the parent field name is defined using the lambda expression passed as a parameter to the ParentField method.

PreviewField. This method defines a field from which the preview row will retrieve its data.

Columns. This property provides access to a collection of strongly-types columns. This collection exposes the specific Add method that accept the lambda expression that defines a particular model field to which the newly created column will be bound.

The specific Add method overload can also accept the delegate method that returns the column settings object. This overload allows you to add a column with specific settings (see the "Is New" and "Has Attachment" columns in this demo).

Note that the partial View with the TreeList extension does not need to be strongly-typed.

Get started today and download your 30-day trial of DevExpress MVC Extensions (includes 30 days of free technical support).

All demos ship with full source code and are included in the DevExpress MVC distribution. Refer to the Demos and Sample Applications topic to learn more.

DevExpress MVC Extensions ship as part of DevExpress Universal, DXperience and ASP.NET Subscriptions and are backed by a 60 day unconditional money-back guarantee.
To learn more and obtain pricing information, visit the Compare Features and Pricing webpage. For immediate assistance, contact us by Email at info@devexpress.com or by phone at +1 (818) 844-3383 between 7:30am and 4:30pm Pacific Time.