ComplexWebListEditor.FindPropertyEditor(IModelMemberViewItem, ViewEditMode) Method

Provides access to the ComplexWebListEditor's Property Editor, corresponding to the specified Application Model's node.

Namespace: DevExpress.ExpressApp.Web.Editors

Assembly: DevExpress.ExpressApp.Web.v18.2.dll

Declaration

public WebPropertyEditor FindPropertyEditor(
    IModelMemberViewItem modelViewItem,
    ViewEditMode viewEditMode
)
Public Function FindPropertyEditor(
    modelViewItem As IModelMemberViewItem,
    viewEditMode As ViewEditMode
) As WebPropertyEditor

Parameters

Type Name Description
IModelMemberViewItem modelViewItem

An IModelMemberViewItem object, representing the Application Model's node, corresponding to the required Property Editor.

ViewEditMode viewEditMode

A ViewEditMode enumeration value that specify the display mode.

Returns

Type Description
WebPropertyEditor

A WebPropertyEditor, corresponding to the specified Application Model's node.

The FindPropertyEditor method returns the specified column's Property Editor. This Property Editor uses the IModelColumn settings when it instantiates the columnn's cell controls. You can cusotmize this Property Editor and handle its events to change the grid cells' appearance and behavior. The Property Editor's settings can be used differently in different ComplexWebListEditor descendants.

In ASPxGridListEditor, this method applies to the following tasks:

To customize ASPxGridListEditor cell settings in other cases, use standard ASPxGridView approaches - for example, change the GridViewEditDataColumn.PropertiesEdit settings.

The ViewController below accesses and changes an Edit mode inline editor (LastName) in the Contact List View. This code snippet demonstrates the first approach from the list above.

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Web.Editors.ASPx;

public class MyViewController : ObjectViewController<ListView, Contact> {
    ASPxStringPropertyEditor lastNameEditor;
    protected override void OnViewControlsCreated() {
        base.OnViewControlsCreated();
        if (lastNameEditor == null) {
            ASPxGridListEditor gridListEditor = View.Editor as ASPxGridListEditor;
            if (gridListEditor != null) {
                lastNameEditor = gridListEditor.FindPropertyEditor("LastName", ViewEditMode.Edit) as ASPxStringPropertyEditor;
                if (lastNameEditor != null) {
                    lastNameEditor.ControlCreated += lastNameEditor_ControlCreated;
                }
            }
        }
    }
    void lastNameEditor_ControlCreated(object sender, EventArgs e) {
        ASPxStringPropertyEditor lastNameEditor = (ASPxStringPropertyEditor)sender;
        if (lastNameEditor.Editor != null) {
            lastNameEditor.Editor.SelectInputTextOnClick = true;
        }
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        if (lastNameEditor != null) {
            lastNameEditor.ControlCreated -= lastNameEditor_ControlCreated;
            lastNameEditor = null;
        }
    }
}
See Also