This example shows how you can display only the group data for a column and surpress the detail row data from view.
This can be useful when you have repeating data or your users only need the total.
The column data and text are used for the calculations, so removing the column or its text will prevent the footer aggregate from working. This means that there is no out of the box solution for this case.
There are, however, three options that provide slightly different results and flexibility:
- in the PreRender event of the grid, remove the column texts that is duplicate. This keeps the column in the grid, but its data is blank.
- use a custom footer and set the column Display property to false (merely setting it to false will hide it from the footer as well). This hides the column from view but also removes the other built-in cells and data from the footer, so you need to create your own formatting and alignmet for it.
- perform the calculations yourself in ItemDataBound and set the footer text with your own code, then remove the text from the items. Provides the most flexibility in terms of the actual calculation and lets you keep the default footer, while changing only a certain cell.
Below is an example built on top of the Group Footers demo that illustrates each of them. It uses the UnitPrice column.