ASPxCardView.SummaryDisplayText Event
Enables custom display text to be provided for any summary value.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
public event ASPxCardViewSummaryDisplayTextEventHandler SummaryDisplayText
#Event Data
The SummaryDisplayText event's data class is ASPxCardViewSummaryDisplayTextEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Encode |
Gets or sets a value that specifies whether the summary display text keeps any of its values that are HTML as HTML, or instead, strips out the HTML markers.
Inherited from ASPx |
Item | Gets a summary item whose value is being processed. |
Text |
Gets or sets the display text for the summary value currently being processed.
Inherited from ASPx |
Value |
Gets the processed summary value.
Inherited from ASPx |
#Remarks
The SummaryDisplayText event is raised for total summaries.
Initialy, the event parameter’s ASPxGridSummaryDisplayTextEventArgs.Text property contains the text currently displayed in the summary panel. To provide custom text, assign it to this property.
#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.
<dx:ASPxCardView ID="ASPxCardView1" KeyFieldName="CategoryID" ClientInstanceName="grid"
OnSummaryDisplayText="ASPxCardView1_SummaryDisplayText"
AutoGenerateColumns="False"DataSourceID="AccessDataSource1" runat="server">
<Settings ShowSummaryPanel="True" />
<Columns>
<dx:CardViewTextColumn FieldName="CategoryID" ReadOnly="True" />
<dx:CardViewTextColumn FieldName="CategoryName" />
<dx:CardViewTextColumn FieldName="Description" />
</Columns>
<TotalSummary>
<dx:ASPxCardViewSummaryItem FieldName="CategoryID" SummaryType="Sum" />
</TotalSummary>
</dx:ASPxCardView>
<dx:ASPxSpinEdit ID="ASPxSpinEdit1" runat="server" Number="0" Height="21">
<ClientSideEvents NumberChanged="function(s, e) {
grid.PerformCallback();
}" />
</dx:ASPxSpinEdit>
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));
}