Skip to main content

DxGrid.GetTotalSummaryLabel(IGridSummaryItem) Method

Gets the name of a total summary‘s function name.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public string GetTotalSummaryLabel(
    IGridSummaryItem item
)

Parameters

Name Type Description
item IGridSummaryItem

The total summary item.

Returns

Type Description
String

The total summary function’s name.

Remarks

Specify the DisplayText property or handle the CustomizeSummaryDisplayText event to customize the summary display text.

The following code snippet customizes the Unit Price column’s total summary. The summary contains the summary’s label and formatted value.

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable
@* ... *@
<DxGrid @ref="Grid3"
        Data="@Data">
    <Columns>
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="180px">
            <FooterTemplate>
                @{
                    var summaryItems = context.SummaryItems;
                    if (summaryItems.Any())
                    {
                        foreach (var i in summaryItems)
                        {
                            @context.Grid.GetTotalSummaryLabel(i)
                            <text> of </text>
                            @context.DataColumn.FieldName
                            <text>: </text>
                            @context.Grid.GetTotalSummaryFormattedValue(i)
                        }
                    }
                }
            </FooterTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" ValueDisplayFormat="c" FieldName="UnitPrice" />
    </TotalSummary>
</DxGrid>
@* ... *@
@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }
    @* ... *@
    IGrid Grid3 { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Invoices
            .ToList();
    }
    @* ... *@
    public void Dispose() {
        Northwind?.Dispose();
    }
}

DevExpress Blazor Grid - Total Summary Function Name

For more information about summaries in the Grid component, refer to the following topic: Summary in Blazor Grid.

See Also