.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.CustomizeGridViewDataColumn Event

Occurs after the data column is created, before it is added to the grid control.

Namespace: DevExpress.ExpressApp.Web.Editors.ASPx

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

Declaration

public event EventHandler<CustomizeGridViewDataColumnEventArgs> CustomizeGridViewDataColumn
Public Event CustomizeGridViewDataColumn As EventHandler(Of CustomizeGridViewDataColumnEventArgs)

Event Data

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

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

Remarks

Handle this event to customize the column after the Application Model settings are applied to it and the ITemplate templates are assigned to the GridViewDataColumn.DataItemTemplate and GridViewDataColumn.EditItemTemplate properties.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Web.Editors.ASPx;
// ...
public class CustomizeGridViewDataColumnController : ObjectViewController<ListView, Person> {
    protected override void OnActivated() {
        base.OnActivated();
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CustomizeGridViewDataColumn += listEditor_CustomizeGridViewDataColumn;
    }
    private void listEditor_CustomizeGridViewDataColumn(object sender, CustomizeGridViewDataColumnEventArgs e) {
        if (e.ModelColumn.Id == "FirstName") {
            e.Column.Caption = "Custom FirstName Caption";
        }
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        ASPxGridListEditor listEditor = (ASPxGridListEditor)View.Editor;
        listEditor.CustomizeGridViewDataColumn -= listEditor_CustomizeGridViewDataColumn;
    }
}
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