ASPxGridView.SummaryDisplayText Event
Enables custom display text to be provided for any summary value.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Event Data
The SummaryDisplayText event's data class is ASPxGridViewSummaryDisplayTextEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
EncodeHtml | 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 ASPxGridSummaryDisplayTextEventArgs. |
IsGroupSummary | Indicates whether a group summary value is processed. |
IsTotalSummary | Indicates whether a total summary value is being processed. |
Item | Gets the processed summary item. |
Text | Gets or sets the display text for the summary value currently being processed. Inherited from ASPxGridSummaryDisplayTextEventArgs. |
Value | Gets the processed summary value. Inherited from ASPxGridSummaryDisplayTextEventArgs. |
VisibleIndex | Gets a value that identifies the group row where the processed summary value is displayed. |
Remarks
The SummaryDisplayText
event is raised for both group and total summaries. Use the IsGroupSummary and IsTotalSummary argument properties to identify which summary value is being processed.
Initialy the event’s Text argument property contains the text string that the grid currently displays in the group row or footer cell. To customize this text string, assign a new value to this property.
Batch Edit Mode Specifics
In batch edit mode, the grid does not raise the SummaryDisplayText
event and calculates summaries on the client side. To allow ASPxGridView to raise the server-side SummaryDisplayText
event, set the control’s EnableRealTimeSummaryRecalculation property to false
.
<dx:ASPxGridView ID="Grid" runat="server" ...>
<!-- ... -->
<SettingsEditing Mode="Batch">
<BatchEditSettings EnableRealTimeSummaryRecalculation="false" />
</SettingsEditing>
</dx:ASPxGridView>
Example
The following example calculates a summary in the CategoryID column based on the value in a ASPxSpinEdit.
When a 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 assigns this value to the Text argument property.
protected void ASPxGridView1_SummaryDisplayText(object sender, ASPxGridViewSummaryDisplayTextEventArgs e) {
if(e.Item.FieldName == "CategoryID")
e.Text = string.Format("Sum = {0}", Convert.ToDouble(e.Value) * Convert.ToDouble(ASPxSpinEdit1.Value));
}