Skip to main content
A newer version of this page is available. .

ASPxGridListEditor.CreateCustomGridViewDataColumn Event

Occurs when the data column is created.

Namespace: DevExpress.ExpressApp.Web.Editors.ASPx

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

Declaration

public event EventHandler<CreateCustomGridViewDataColumnEventArgs> CreateCustomGridViewDataColumn

Event Data

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

Property Description
Column Specifies the data column.
GridViewDataColumnInfo Specifies the data column info.
ModelColumn Gets the Application Model settings of the column.

Remarks

Handle the CreateCustomGridViewDataColumn event to create a custom data column. After creation, the Application Model settings are applied to the column. Additionally, the ASPxGridListEditor.CreateCustomDataItemTemplate and ASPxGridListEditor.CreateCustomEditItemTemplate are triggered if the GridViewDataColumn.DataItemTemplate and GridViewDataColumn.EditItemTemplate templates are not assigned.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Web.Editors.ASPx;
// ...
public class CreateCustomGridViewDataColumnController : ObjectViewController<ListView, Person> {
    protected override void OnActivated() {
        base.OnActivated();
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CreateCustomGridViewDataColumn += listEditor_CreateCustomGridViewDataColumn;
    }
    private void listEditor_CreateCustomGridViewDataColumn(
        object sender, CreateCustomGridViewDataColumnEventArgs e) {
        // ...
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CreateCustomGridViewDataColumn -= listEditor_CreateCustomGridViewDataColumn;
    }
}

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