ASPxVerticalGrid.GetTotalSummaryValue(ASPxVerticalGridSummaryItem) Method
Returns a summary value calculated against all records.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
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
Note
A complete sample project is available at https://github.com/DevExpress-Examples/aspxverticalgrid-how-to-calculate-the-total-summary-based-on-values-of-other-summaries-t437335
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="DevExpress.Web.v16.2, Version=16.2.1.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web" tagprefix="dx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxVerticalGrid ID="ASPxVerticalGrid1" runat="server" OnCustomSummaryCalculate="ASPxVerticalGrid1_CustomSummaryCalculate" Width="700px" AutoGenerateRows="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
<Rows>
<dx:VerticalGridTextRow FieldName="ProductID" VisibleIndex="0">
</dx:VerticalGridTextRow>
<dx:VerticalGridTextRow FieldName="ProductName" VisibleIndex="1">
</dx:VerticalGridTextRow>
<dx:VerticalGridTextRow FieldName="UnitPrice" VisibleIndex="2">
</dx:VerticalGridTextRow>
<dx:VerticalGridTextRow FieldName="UnitsInStock" VisibleIndex="3">
</dx:VerticalGridTextRow>
<dx:VerticalGridTextRow FieldName="UnitsOnOrder" VisibleIndex="4">
</dx:VerticalGridTextRow>
</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>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice], [UnitsInStock], [UnitsOnOrder] FROM [Products]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
See Also