The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxGridListEditor.CreateCustomEditItemTemplate Event

Occurs when the GridViewDataColumn.EditItemTemplate is initialized.

Namespace: DevExpress.ExpressApp.Web.Editors.ASPx

Assembly: DevExpress.ExpressApp.Web.v19.1.dll

Declaration

public event EventHandler<CreateCustomEditItemTemplateEventArgs> CreateCustomEditItemTemplate
Public Event CreateCustomEditItemTemplate As EventHandler(Of CreateCustomEditItemTemplateEventArgs)

Event Data

The CreateCustomEditItemTemplate event handler receives an argument of the CreateCustomEditItemTemplateEventArgs type. The following properties provide information specific to this event.

Property Description
DataItemTemplateInfoProvider Gets the object that provides info on the GridViewDataColumn.DataItemTemplate.
Handled Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing.
(Inherited from HandledEventArgs)
ModelColumn Gets the Application Model settings of the column.
Template Specifies a template that is used to display a data cell or edit cell.

Remarks

This event is triggered when the current List View is editable (see View.AllowEdit) and the GridViewDataColumn.EditItemTemplate is null (Nothing in VB). To specify a custom ITemplate, handle this event, pass the custom ITemplate object to the handler's CreateCustomItemTemplateEventArgs.Template parameter and set the Handled parameter to true. If you set Handled to true, and do not initialize Template, the default column behavior will be used.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Web.Editors.ASPx;
// ...
public class CreateCustomEditItemTemplateController : ObjectViewController<ListView, Person> {
    protected override void OnActivated() {
        base.OnActivated();
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CreateCustomEditItemTemplate += listEditor_CreateCustomEditItemTemplate;
    }
    private void listEditor_CreateCustomEditItemTemplate(
        object sender, CreateCustomEditItemTemplateEventArgs e) {
        // ...
        e.Handled = true;
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CreateCustomEditItemTemplate -= listEditor_CreateCustomEditItemTemplate;
    }
}
Important

You should subscribe to this event before the View.ControlsCreated event occurs (e.g., in the overridden OnActivated method of a custom Controller). It is too late to customize columns when the grid control has already been created.

See Also