Back to Devexpress

GridViewColumn.Columns Property

aspnet-devexpress-dot-web-dot-gridviewcolumn.md

latest3.4 KB
Original Source

GridViewColumn.Columns Property

Provides access to a collection of columns that the current column combines.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public GridViewColumnCollection Columns { get; }
vb
Public ReadOnly Property Columns As GridViewColumnCollection

Property Value

TypeDescription
GridViewColumnCollection

An GridViewColumnCollection object that is a collection of columns grouped by the current column.

|

Remarks

The Columns property stores a collection of GridViewColumn objects. This allows you to create data cell bands. The obtained column collection provides methods that allow you to add new and remove existing columns. Individual columns can be accessed using indexed notation.

Concept

Data Cell Bands

Example

In markup:

aspx
<dx:ASPxGridView ID="Grid" runat="server" ...>
    <Columns>
        <dx:GridViewDataColumn FieldName="Address">
            <Columns>
                <dx:GridViewDataColumn FieldName="Features">
                    <Columns>
                        <dx:GridViewDataColumn FieldName="Beds" />
                        ...
                    </Columns>
                </dx:GridViewDataColumn>
                ...
            </Columns>
        </dx:GridViewDataColumn>
    </Columns>
</dx:ASPxGridView>

In code:

csharp
ASPxGridView grid1 = new ASPxGridView();
grid1.ID = "grid1";
Page.Form.Controls.Add(grid1);
...
GridViewDataColumn address = new GridViewDataColumn();
address.FieldName = "Address";

GridViewDataColumn features = new GridViewDataColumn();
features.FieldName = "Features";        

GridViewDataColumn beds = new GridViewDataColumn();
beds.FieldName = "Beds";

address.Columns.Add(features);
features.Columns.Add(beds);

Online Example

ASPxGridView - How to create header and data cell bands

Online Demo

ASPxGridView - Data Cell Bands

Online Video

ASPxGridView - Data Cell Bands

See Also

Grid View

Header Bands

Data Cell Bands

GridViewColumn Class

GridViewColumn Members

DevExpress.Web Namespace