Change Theme Settings
Change Theme Settings
Material Compact
Office 365
Show All Themes

Column Binding via Lambdas

 FromSubjectDateIs NewHas Attachment
CollapseDeveloper Express - RayNew Holiday Skin12/10/2007 1:49:00 PM
  Matthew RobertsRe: New Holiday Skin12/10/2007 3:57:00 PM
 CollapseTrevor WesterdahlRe: New Holiday Skin12/10/2007 4:05:00 PM
   NC SoftwareRe: New Holiday Skin12/10/2007 4:07:00 PM
 CollapseAndy WallRe: New Holiday Skin12/11/2007 12:42:00 PM
  CollapseMax V. Evseev (Developer Express)Re: New Holiday Skin12/12/2007 6:49:00 AM
    Brendon MuckRe: New Holiday Skin12/12/2007 9:25:00 AM
    Andy WallRe: New Holiday Skin12/12/2007 10:31:00 AM
   ExpandNC SoftwareRe: New Holiday Skin12/12/2007 2:20:00 PM
    JaschaRe: New Holiday Skin12/15/2007 3:18:00 PM
 Collapsewolfgang hauerRe: New Holiday Skin12/13/2007 1:55:00 PM
   James MurrayRe: New Holiday Skin12/15/2007 5:37:00 AM

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.