Back to Devexpress

TreeListExtension Class

aspnetmvc-devexpress-dot-web-dot-mvc-8288fdd9.md

latest4.8 KB
Original Source

TreeListExtension Class

An extension object implementing the TreeList functionality.

Namespace : DevExpress.Web.Mvc

Assembly : DevExpress.Web.Mvc5.v25.2.dll

NuGet Package : DevExpress.Web.Mvc5

Declaration

csharp
public class TreeListExtension :
    ExtensionBase
vb
Public Class TreeListExtension
    Inherits ExtensionBase

The following members return TreeListExtension objects:

Remarks

To declare the TreeList in a View, invoke the ExtensionsFactory.TreeList helper method. This method returns the TreeList extension that is implemented by the TreeListExtension class.

To configure the TreeList extension, pass the TreeListSettings object to the ExtensionsFactory.TreeList helper method as a parameter. The TreeListSettings object contains all the TreeList extension settings.

Concepts

TreeList Overview

Example

razor
@Html.DevExpress().TreeList(settings => {
    settings.Name = "treeList";
    settings.CallbackRouteValues = new { Controller = "Editing", Action = "BatchEditingPartial" };
    settings.SettingsEditing.BatchUpdateRouteValues = new { Controller = "Editing", Action = "BatchEditingUpdateModel" };

    settings.SettingsEditing.Mode = TreeListEditMode.Batch;

    settings.Columns.Add("From");
    settings.Columns.Add("Subject");
    settings.Columns.Add(c => {
        c.FieldName = "PostDate";
        c.Caption = "Date";
        c.EditorProperties().DateEdit(p => {
            p.DisplayFormatString = "dd/MM/yyyy hh:mm tt";
            p.DisplayFormatInEditMode = true;
            p.EditFormat = EditFormat.DateTime;
        });
    });
    settings.Columns.Add(c => {
        c.FieldName = "IsNew";
        c.ColumnType = MVCxTreeListColumnType.CheckBox;
        c.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
    });
    ...
}).SetEditErrorText(ViewData["EditNodeError"] as string).Bind(Model).GetHtml()

Online Demos

Tree List Demos

Inheritance

Object ExtensionBase TreeListExtension TreeListExtension<RowType>

See Also

TreeListExtension Members

Tree List

TreeListSettings

DevExpress.Web.Mvc Namespace