ASPxCardViewSummaryDisplayTextEventArgs.Item Property
Gets a summary item whose value is being processed.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v22.1.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
Type | Description |
---|---|
ASPxCardViewSummaryItem | An ASPxCardViewSummaryItem object that represents the summary item whose value is being processed. |
Example
The following example calculates a summary in the CategoryID column based on the value in the ASPxSpinEdit below it.
When an end user changes a spin editor value, the editor sends a custom callback to the server in the client-side NumberChanged event handler. In the server-side SummaryDisplayText event handler, the grid calculates the summary value and sets it to the e.Text parameter.
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCardView ID="ASPxCardView1" KeyFieldName="CategoryID" OnSummaryDisplayText="ASPxCardView1_SummaryDisplayText" AutoGenerateColumns="False" ClientInstanceName="grid" DataSourceID="AccessDataSource1" runat="server">
<Settings ShowSummaryPanel="True" />
<Columns>
<dx:CardViewTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="CategoryName" VisibleIndex="1">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="Description" VisibleIndex="2">
</dx:CardViewTextColumn>
</Columns>
<TotalSummary>
<dx:ASPxCardViewSummaryItem FieldName="CategoryID" SummaryType="Sum" />
</TotalSummary>
</dx:ASPxCardView>
<br />
<dx:ASPxSpinEdit ID="ASPxSpinEdit1" runat="server" Number="0" Height="21">
<ClientSideEvents NumberChanged="function(s, e) {
grid.PerformCallback();
}" />
</dx:ASPxSpinEdit>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT * FROM [Categories]"></asp:AccessDataSource>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e) {
}
protected void ASPxCardView1_SummaryDisplayText(object sender, DevExpress.Web.ASPxCardViewSummaryDisplayTextEventArgs e) {
if (e.Item.FieldName == "CategoryID")
e.Text = string.Format("Sum = {0}", Convert.ToDouble(e.Value) * Convert.ToDouble(ASPxSpinEdit1.Value));
}
}
See Also