GridColumnSummaryItem.FieldName Property
Gets or sets a name of the field for which a total summary should be calculated.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v19.1.dll
Declaration
Property Value
Type | Description |
---|---|
String | A string value that specifies the column’s field name for which a total summary should be calculated. |
Remarks
You can set a field name for a total summary via the FieldName property. If the field name is not set, then the total summary is calculated against the column’s field name (GridColumn.FieldName).
To add total summaries to a collection and set field names for them at design time, use a collection editor as shown in the image below.
Example
The example demonstrates how to add a total summary and set its summary type, field name and display format. Note that a summary is added for the Units In Stock column and it will be shown in this column. However, the summary will be calculated against a Unit Price field name.
GridColumnSummaryItem item = colUnitsInStock1.Summary.Add();
item.SummaryType = DevExpress.Data.SummaryItemType.Average;
item.FieldName = "UnitPrice";
item.DisplayFormat = "Average Unit Price = {0:c2}";
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FieldName property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.