Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Create a Column and Assign an Editor to It

The following example demonstrates how to create a column within a View, and assign a specific editor to it.

    using DevExpress.XtraGrid.Views.BandedGrid;
    using DevExpress.XtraEditors.Repository;
    //...
    // Create a column
    BandedGridColumn col = advBandedGridView1.Columns.Add("Country") as BandedGridColumn;
    // Add a column to the first Band
    advBandedGridView1.Bands[0].Columns.Add(col);
    // Show the new column
    col.Visible = true;
    // Create a Repository Item
    RepositoryItemLookUpEdit columnEditor = new RepositoryItemLookUpEdit();
    // Customize the editor
    //...
    // Add the new Repository Item to the "RepositoryItems" collection
    gridControl1.RepositoryItems.Add(columnEditor);
    // Assign the editor to the new column
    col.ColumnEdit = columnEditor;

See the Cell Values, Editors, and Validation topic for more information about column editors.