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.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
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.
gridView1.OptionsView.ShowFooter = true;
GridColumnSummaryItem item = colUnitsInStock1.Summary.Add();
item.SummaryType = DevExpress.Data.SummaryItemType.Average;
item.FieldName = "UnitPrice";
item.DisplayFormat = "Average Unit Price = {0:c2}";