Skip to main content

TreeListSettings.CellEditorInitialize Property

Enables initializing the cell editors displayed within the edit cells.

Namespace: DevExpress.Web.Mvc

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

Declaration

public TreeListColumnEditorEventHandler CellEditorInitialize { get; set; }

Property Value

Type Description
TreeListColumnEditorEventHandler

A TreeListColumnEditorEventHandler delegate method allowing you to implement custom processing.

Remarks

The CellEditorInitialize event is raised when the TreeList is switched to edit mode and enables you to initialize cell editors.

Note

  • The CellEditorInitialize event affects only the edit mode settings (when editors are visible).
  • The CellEditorInitialize event isn’t raised for edit cells that contain custom editors defined using templates.
  • The CellEditorInitialize event fires only for built-in column editors.

Examples

  • The following example illustrates how to use the CellEditorInitialize event to automatically focus the required column’s editor using the editor’s ASPxWebControl.Focus method (the e.Editor event argument).

    settings.CellEditorInitialize = (s, e) => {
        if (e.Column.FieldName == "TimeFrom")
        {
            e.Editor.Focus();
        }
    };
    
  • This example shows how to prevent end-users from changing the Department of root nodes. The CellEditorInitialize is raised when the TreeList is switched to edit mode, and enables you to initialize cell editors. If the edited node resides within the first nesting level and the processed editor corresponds to the Department column, the editor is disabled.

    settings.CellEditorInitialize = (s, e) => {
        MVCxTreeList treeListControl = (MVCxTreeList)sender;
        if (treeListControl.FindNodeByKeyValue(e.NodeKey).Level == 1 && 
             e.Column.FieldName == "Department")
            e.Editor.Enabled = false;
    }
    

    The image below shows the result:

    exCellEditorInitialize

See Also