Skip to main content
Tab

ASPxGridView.AllColumns Property

Gets the collection of all columns within the ASPxGridView control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public ReadOnlyGridColumnCollection<GridViewColumn> AllColumns { get; }

Property Value

Type Description
ReadOnlyGridColumnCollection<GridViewColumn>

A collection of all the columns in an ASPxGridView.

Remarks

The AllColumns property provides access to a collection that contains all the columns of the ASPxGridView control (this includes columns of all the bands, if a banded layout is used). This collection is read-only, since individual columns can be manipulated (added or removed) at the level of a grid control (ASPxGridView.Columns) or a band column (GridViewColumn.Columns). The collection obtained via the AllColumns property allows you to easily iterate through all the grid columns and access any required column identified by its specific setting or type.

Example

This sample demonstrates how the AllColumns method can be used to centrally define a display format for all date columns within a ASPxGridView control.

using DevExpress.Web.ASPxGridView;
...
    public void ChangeDateColumnDisplayFormat() { 
        foreach(GridViewColumn column in Grid.AllColumns) {
            GridViewDataDateColumn dateColumn = column as GridViewDataDateColumn;
            if(dateColumn != null)
               dateColumn.PropertiesDateEdit.DisplayFormatString = "d MMM yyyy";
       }
    }
See Also