TreeListSettings.CellEditorInitialize Property
Enables initializing the cell editors displayed within the edit cells.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
NuGet Package: DevExpress.Web.Mvc5
#Declaration
public TreeListColumnEditorEventHandler CellEditorInitialize { get; set; }
#Property Value
Type | Description |
---|---|
Tree |
A Tree |
#Remarks
The CellEditorInitialize event is raised when the TreeList is switched to edit mode and enables you to initialize cell editors.
Note
- The Cell
Editor event affects only the edit mode settings (when editors are visible).Initialize - The Cell
Editor event isn’t raised for edit cells that contain custom editors defined using templates.Initialize - The Cell
Editor event fires only for built-in column editors.Initialize
#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: