Skip to main content
Tab

ASPxVerticalGrid.GetTotalSummaryValue(ASPxVerticalGridSummaryItem) Method

Returns a summary value calculated against all records.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public object GetTotalSummaryValue(
    ASPxVerticalGridSummaryItem item
)

Parameters

Name Type Description
item ASPxVerticalGridSummaryItem

An ASPxVerticalGridSummaryItem object that represents the summary item.

Returns

Type Description
Object

An object which represents the summary value.

Remarks

The ASPxVerticalGrid enables you to calculate a total summary that calculates an aggregate function by all records and displays the result in the summary panel. A total summary type is represented by a ASPxVerticalGridSummaryItem object.

Example

<dx:ASPxVerticalGrid ID="ASPxVerticalGrid1" runat="server" AutoGenerateRows="False" 
                     OnCustomSummaryCalculate="ASPxVerticalGrid1_CustomSummaryCalculate"
                     DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
    <Rows>
        <dx:VerticalGridTextRow FieldName="ProductID" />
        <dx:VerticalGridTextRow FieldName="ProductName" />
        <dx:VerticalGridTextRow FieldName="UnitPrice" />
        <dx:VerticalGridTextRow FieldName="UnitsInStock" />
        <dx:VerticalGridTextRow FieldName="UnitsOnOrder" />
    </Rows>
    <TotalSummary>                
        <dx:ASPxVerticalGridSummaryItem SummaryType="Average" FieldName="UnitPrice" />
        <dx:ASPxVerticalGridSummaryItem SummaryType="Average" FieldName="UnitsOnOrder" />
        <dx:ASPxVerticalGridSummaryItem SummaryType="Custom" DisplayFormat="Average Sum ={0}" />
    </TotalSummary>
    <Settings ShowSummaryPanel="True" />
    <SettingsPager Mode="ShowPager"></SettingsPager>
</dx:ASPxVerticalGrid>
protected void ASPxVerticalGrid1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) {
    ASPxVerticalGridSummaryItem orderedUnits = (sender as ASPxVerticalGrid).TotalSummary["UnitsOnOrder"];
    ASPxVerticalGridSummaryItem averagePrice = (sender as ASPxVerticalGrid).TotalSummary["UnitPrice"];
    Int32 intOrderedUnits = Convert.ToInt32(((ASPxVerticalGrid)sender).GetTotalSummaryValue(orderedUnits));
    Int32 intAveragePrice = Convert.ToInt32(((ASPxVerticalGrid)sender).GetTotalSummaryValue(averagePrice));
    e.TotalValue = intOrderedUnits * intAveragePrice;
}
See Also