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

ASPxGridListEditor.CreateCustomGridViewDataColumn Event

Occurs when the data column is created.

Namespace: DevExpress.ExpressApp.Web.Editors.ASPx

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

Declaration

public event EventHandler<CreateCustomGridViewDataColumnEventArgs> CreateCustomGridViewDataColumn
Public Event CreateCustomGridViewDataColumn As EventHandler(Of CreateCustomGridViewDataColumnEventArgs)

Event Data

The CreateCustomGridViewDataColumn event handler receives an argument of the CreateCustomGridViewDataColumnEventArgs type. 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