ASPxGridView.AddSummaryItemViaContextMenu Event
Fires when a total summary item is added to the ASPxGridView.TotalSummary collection using the context menu.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
public event ASPxGridViewAddSummaryItemViaContextMenuEventHandler AddSummaryItemViaContextMenu
Event Data
The AddSummaryItemViaContextMenu event's data class is ASPxGridViewAddSummaryItemViaContextMenuEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Column | Gets a data column to whose footer a summary item is added. |
IsGroupSummary | Indicates whether a total summary item or a group summary item has been added to a summary collection using the context menu. |
SummaryItem | Gets a summary item that is added to the grid footer. |
Remarks
The AddSummaryItemViaContextMenu event fires when a total summary item is added to the ASPxGridView.TotalSummary collection using the context menu. You can use this event handler to provide a custom display format for a summary item.
Note
The context menu allows end-users to add and remove total summary items from the ASPxGridView.TotalSummary collection. However, if a total summary item is added to the ASPxGridView.TotalSummary collection programmatically (in markup or in code behind), the context menu allows end-users to hide this item (set the ASPxSummaryItemBase.Visible property to false
) retaining it in the collection.
Example
The code sample below demonstrates how to handle the AddSummaryItemViaContextMenu event to format a summary item’s display text. The complete sample is available in the DevExpress online demo Grid Columns - Context Menu.
protected void Grid_AddSummaryItemViaContextMenu(object sender, ASPxGridViewAddSummaryItemViaContextMenuEventArgs e) {
if(e.SummaryItem.FieldName == "UnitsInStock" && e.SummaryItem.SummaryType == SummaryItemType.Average)
e.SummaryItem.ValueDisplayFormat = "{0:0.00}";
}