Back to Devexpress

GridViewDataColumn.CellRowSpan Property

aspnet-devexpress-dot-web-dot-gridviewdatacolumn-46152d25.md

latest4.4 KB
Original Source

GridViewDataColumn.CellRowSpan Property

Specifies the number of rows that a column (i.e., column header and data cells containing the column data) spans.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(1)]
public int CellRowSpan { get; set; }
vb
<DefaultValue(1)>
Public Property CellRowSpan As Integer

Property Value

TypeDefaultDescription
Int321

An integer value that specifies the number of rows that the column spans.

|

Remarks

When the grid uses data cell bands, the grid header’s height is equal to the maximum depth of the column hierarchy. By default, a column occupies one row; the deepest column (without child columns) occupies the remaining free space.

Use the CellRowSpan property to specify the number of rows that a column (i.e., column header and data cells) spans.

Example 1

The maximum depth of a columns hierarchy is equal to three (for the Address column). By default, the Photo column occupies one row, and the deepest child column (Price) occupies remaining free space, i.e., two rows.

aspx
<dx:ASPxGridView ID="Grid" >
    <Columns>
        <dx:GridViewDataImageColumn FieldName="PhotoUrl" Caption="Photo" />
        <dx:GridViewDataColumn FieldName="Address" CellRowSpan="3">
            <Columns>
                <dx:GridViewDataColumn FieldName="Features">
                    <Columns>
                        <dx:GridViewDataColumn FieldName="Beds" />
                        <dx:GridViewDataColumn FieldName="Baths" />
                        <dx:GridViewDataColumn FieldName="HouseSize" />
                        <dx:GridViewDataColumn FieldName="YearBuilt" />
                    </Columns>
                </dx:GridViewDataColumn>
                <dx:GridViewDataSpinEditColumn FieldName="Price" />
            </Columns>
        </dx:GridViewDataColumn>
    </Columns>
</dx:ASPxGridView>

Example 2

In this example, the CellRowSpan property is set to 2 for Photo column, therefore it occupies two rows.

aspx
<dx:ASPxGridView ID="Grid" >
    <Columns>
        <dx:GridViewDataImageColumn FieldName="PhotoUrl" Caption="Photo" CellRowSpan="2" />
        <dx:GridViewDataColumn FieldName="Address" >
            <Columns>
                <dx:GridViewDataColumn FieldName="Features">
                    <Columns>
                        <dx:GridViewDataColumn FieldName="Beds" />
                        <dx:GridViewDataColumn FieldName="Baths" />
                        <dx:GridViewDataColumn FieldName="HouseSize" />
                        <dx:GridViewDataColumn FieldName="YearBuilt" />
                    </Columns>
                </dx:GridViewDataColumn>
                <dx:GridViewDataSpinEditColumn FieldName="Price" />
            </Columns>
        </dx:GridViewDataColumn>
    </Columns>
</dx:ASPxGridView>

Concept

Data Cell Bands

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

GridViewDataColumn Class

GridViewDataColumn Members

DevExpress.Web Namespace