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.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Web
Declaration
public WebPropertyEditor FindPropertyEditor(
IModelMemberViewItem modelViewItem,
ViewEditMode viewEditMode
)
Parameters
Name | Type | Description |
---|---|---|
modelViewItem | IModelMemberViewItem | 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. |
Remarks
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 inline editors when the ListView‘s InlineEditMode is not Batch.
- To customize View mode cell controls when the UseASPxGridViewDataSpecificColumns property is false.
- To customize View mode cell controls inside columns that have a certain PropertyEditorType - for example, ASPxImagePropertyEditor, FileDataPropertyEditor or custom property editors. Such columns are of the GridViewDataColumn data type, and their DataItemTemplate is ViewModeDataItemTemplate.
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;
}
}
}