Skip to main content

DxGrid.GetTotalSummaryValue(IGridSummaryItem) Method

Gets a total summary item’s value.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public object GetTotalSummaryValue(
    IGridSummaryItem item
)

Parameters

Name Type Description
item IGridSummaryItem

The total summary item.

Returns

Type Description
Object

The total summary value.

Remarks

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

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable
@* ... *@
<DxGrid Data="@Data">
    <Columns>
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate"  />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="150px">
            <FooterTemplate>
                @{
                    var summaryItems = context.Grid.GetTotalSummaryItems();
                    if (summaryItems.Any())
                    {
                        foreach (var i in summaryItems)
                        {
                            @context.Grid.GetTotalSummaryLabel(i)
                            <text>: </text>
                            <b>@context.Grid.GetTotalSummaryValue(i)</b>
                        }
                    }
                }
            </FooterTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="UnitPrice" />
    </TotalSummary>
</DxGrid>
@* ... *@
@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }
    @* ... *@
    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Invoices
            .ToList();
    }
    @* ... *@
    public void Dispose() {
        Northwind?.Dispose();
    }
}

DevExpress Blazor Grid - Total Summary Value

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

See Also