Skip to main content

ASPxTreeList.CellEditorInitialize Event

Enables initializing the cell editors displayed within the edit cells.

Namespace: DevExpress.Web.ASPxTreeList

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

Declaration

public event TreeListColumnEditorEventHandler CellEditorInitialize

Event Data

The CellEditorInitialize event's data class is TreeListColumnEditorEventArgs. The following properties provide information specific to this event:

Property Description
Column Gets the data column whose cell editor is being initialized.
Editor Gets the editor currently being processed.
NodeKey Gets the key value that uniquely identifies the node whose values are being initialized.
Value Gets the editor’s value.

Remarks

The CellEditorInitialize event is raised when the ASPxTreeList 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).

    protected void ASPxTreeList1_CellEditorInitialize(object sender,
        DevExpress.Web.TreeListColumnEditorEventArgs 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 ASPxTreeList 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.

    protected void ASPxTreeList1_CellEditorInitialize(object sender,
    TreeListColumnEditorEventArgs e) {
        if (ASPxTreeList1.FindNodeByKeyValue(e.NodeKey).Level == 1 && 
             e.Column.FieldName == "Department")
            e.Editor.Enabled = false;
    }
    

    The image below shows the result:

    exCellEditorInitialize

See Also