The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.
.NET Core 3.0+
The page you are viewing does not exist in the .NET Core 3.0+ platform documentation. This link will take you to the parent topic of the current section.

ASPxGridListEditor.CreateCustomDataItemTemplate Event

Occurs when the GridViewDataColumn.DataItemTemplate is initialized.

Namespace: DevExpress.ExpressApp.Web.Editors.ASPx

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


public event EventHandler<CreateCustomDataItemTemplateEventArgs> CreateCustomDataItemTemplate
Public Event CreateCustomDataItemTemplate As EventHandler(Of CreateCustomDataItemTemplateEventArgs)

Event Data

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

Property Description
CreateDefaultDataItemTemplate Specifies if the default data item template should be created.
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.


This event is triggered when the GridViewDataColumn.DataItemTemplate is null (Nothing in VB) and the column does not display "Protected Content". 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 (the Object.ToString values will be displayed).

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Web.Editors.ASPx;
// ...
public class CreateCustomDataItemTemplateController : ObjectViewController<ListView, Person> {
    protected override void OnActivated() {
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CreateCustomDataItemTemplate += listEditor_CreateCustomDataItemTemplate;
    private void listEditor_CreateCustomDataItemTemplate(
        object sender, CreateCustomDataItemTemplateEventArgs e) {
        // ...
        e.Handled = true;
    protected override void OnDeactivated() {
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CreateCustomDataItemTemplate -= listEditor_CreateCustomDataItemTemplate;

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