aspnet-devexpress-dot-web-dot-aspxverticalgrid-dot-gettotalsummaryvalue-x28-devexpress-dot-web-dot-aspxverticalgridsummaryitem-x29.md
Returns a summary value calculated against all records.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public object GetTotalSummaryValue(
ASPxVerticalGridSummaryItem item
)
Public Function GetTotalSummaryValue(
item As ASPxVerticalGridSummaryItem
) As Object
| Name | Type | Description |
|---|---|---|
| item | ASPxVerticalGridSummaryItem |
An ASPxVerticalGridSummaryItem object that represents the summary item.
|
| Type | Description |
|---|---|
| Object |
An object which represents the summary value.
|
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.
<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;
}
Protected Sub ASPxVerticalGrid1_CustomSummaryCalculate(ByVal sender As Object, ByVal e As DevExpress.Data.CustomSummaryEventArgs)
Dim orderedUnits As ASPxVerticalGridSummaryItem = (TryCast(sender, ASPxVerticalGrid)).TotalSummary("UnitsOnOrder")
Dim averagePrice As ASPxVerticalGridSummaryItem = (TryCast(sender, ASPxVerticalGrid)).TotalSummary("UnitPrice")
Dim intOrderedUnits As Int32 = Convert.ToInt32(DirectCast(sender, ASPxVerticalGrid).GetTotalSummaryValue(orderedUnits))
Dim intAveragePrice As Int32 = Convert.ToInt32(DirectCast(sender, ASPxVerticalGrid).GetTotalSummaryValue(averagePrice))
e.TotalValue = intOrderedUnits * intAveragePrice
End Sub
See Also