Skip to main content

How to: Display Unbound Data in a PivotGrid Control

This example shows how to add an unbound field to the PivotGridControl, to represent the total sum of an order.

Assume that the PivotGridControl is bound to the Order Details datatable (from the nwind sample database), which contains UnitPrice, Quantity and Discount fields. There isn't any field which represents the total sum, however this can be calculated manually as follows: "UnitPrice*Quantity*(1-Discount)".

To solve this task, first it is necessary to create a pivot grid field, whose PivotGridField.UnboundType property should be set to FieldUnboundColumnType.Decimal. Then, you should handle the PivotGridControl.CustomUnboundFieldData event and manually populate the field with data.