ASPxCardView.GetTotalSummaryValue(ASPxCardViewSummaryItem) Method
Returns a summary value calculated against all cards.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Parameters
Name | Type | Description |
---|---|---|
item | ASPxCardViewSummaryItem | An ASPxSummaryItem object that represents the summary item. |
Returns
Type | Description |
---|---|
Object | An object which represents the summary value. |
Remarks
The ASPxCardView enables you to calculate summaries which are aggregate functions based on values of data source fields. The total summary calculates an aggregate function by all cards and displays the result in a footer. The total summary is represented by a ASPxSummaryItem object.
Example
The example below illustrates how to calculate the total summary value based on values of other summaries:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web;
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
protected void ASPxCardView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) {
ASPxCardViewSummaryItem orderedUnits = (sender as ASPxCardView).TotalSummary["UnitsOnOrder"];
ASPxCardViewSummaryItem averagePrice = (sender as ASPxCardView).TotalSummary["UnitPrice"];
Int32 intOrderedUnits = Convert.ToInt32(((ASPxCardView)sender).GetTotalSummaryValue(orderedUnits));
Int32 intAveragePrice = Convert.ToInt32(((ASPxCardView)sender).GetTotalSummaryValue(averagePrice));
e.TotalValue = intOrderedUnits * intAveragePrice;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCardView ID="ASPxCardView1" runat="server" OnCustomSummaryCalculate="ASPxCardView1_CustomSummaryCalculate" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
<Settings ShowSummaryPanel="True" />
<TotalSummary>
<dx:ASPxCardViewSummaryItem SummaryType="Average" FieldName="UnitPrice" />
<dx:ASPxCardViewSummaryItem SummaryType="Average" FieldName="UnitsOnOrder" />
<dx:ASPxCardViewSummaryItem SummaryType="Custom" DisplayFormat="Average Sum ={0}" />
</TotalSummary>
<Columns>
<dx:CardViewTextColumn FieldName="ProductID" ReadOnly="True" Visible="False">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="ProductName" VisibleIndex="0">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitPrice" VisibleIndex="1">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitsInStock" VisibleIndex="2">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitsOnOrder" VisibleIndex="3">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="ReorderLevel" VisibleIndex="4">
</dx:CardViewTextColumn>
<dx:CardViewCheckColumn FieldName="Discontinued" VisibleIndex="5">
</dx:CardViewCheckColumn>
</Columns>
</dx:ASPxCardView>
<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], [ReorderLevel], [Discontinued] FROM [Products]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
See Also