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

GridDataColumnGroupRowTemplateContext.ColumnCaption Property

Returns the caption of the grouped column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public string ColumnCaption { get; }

#Property Value

Type Description
String

The column caption.

#Remarks

Use the ColumnCaption property to access the caption of the grouped column. The caption is defined by the column’s Caption property value. If this value is not specified, the Grid defines the column caption based on the FieldName property value.

Razor
<DxGrid @ref="Grid"
        Data="@Data"
        ShowGroupPanel="true"
        SizeMode="Params.SizeMode"
        ColumnResizeMode="GridColumnResizeMode.NextColumn"
        TextWrapEnabled="false"
        VirtualScrollingEnabled="true">
    <Columns>
        <DxGridDataColumn FieldName="CompanyName" MinWidth="100" />
        <DxGridDataColumn FieldName="Country" GroupIndex="0" Width="10%">
            <GroupRowTemplate>
                <text>@context.ColumnCaption: @context.GroupValue</text>
                @{
                    var summaryItems = context.Grid.GetGroupSummaryItems();
                    if(summaryItems.Any()) {
                        <text> (</text>
                        foreach(var i in summaryItems) {
                            if(i != summaryItems.First()) {
                                <text>, </text>
                            }
                            @context.Grid.GetGroupSummaryLabel(i, context.VisibleIndex)
                            <text>: </text>
                            <b>@context.Grid.GetGroupSummaryFormattedValue(i, context.VisibleIndex)</b>
                        }
                        <text>)</text>
                    }
                }
            </GroupRowTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="City" Width="10%" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="10%" />
        <DxGridDataColumn FieldName="Quantity" Width="10%" />
        <DxGridDataColumn FieldName="Total"
                          UnboundType="GridUnboundColumnType.Decimal"
                          UnboundExpression="[UnitPrice] * [Quantity]"
                          DisplayFormat="c"
                          MinWidth="100"
                          Width="15%" />
    </Columns>
    @* ... *@
</DxGrid>

Blazor Grid Group Row Template

Run Demo: Grid - Group Row Template

See Also