This is a migrated thread and some comments may be shown as answers.

Explicitly set FooterCell.Value is null when exporting data from grid

1 Answer 56 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 06 May 2011, 02:13 AM
When I am exporting the grid to Excel, the "Value" in this footer cell colum is null.  What am I doing wrong?

GridViewDataColumn pyVarColPercentage = gridAdmissions.Columns ["PYVARPercentage"] as GridViewDataColumn;
                decimal priorYearCurrentAdmits = vm.FilteredAdmissions.Sum(a => a.PriorCurrentYearAdmit.ADMITS);
                if (priorYearCurrentAdmits != 0)
                {
                    pyVarColPercentage.Footer = String.Format("{0:P2}", (currentYearAdmits - priorYearCurrentAdmits) / priorYearCurrentAdmits);
                }
                else
                {
                    pyVarColPercentage.Footer = String.Format("{0:P2}", 0);
                }

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 May 2011, 01:10 PM
Hi Mike,

The current export functionality uses the underliyng data to exports the grid results. Therefore, it cannot display information that is directly added in the UI. So it will only export the footer value if it is a result from an aggregate function.

I would recommend you to create your custom aggregate function that implements your logic for calculating the footer. You could find more information regarding this in this online demo for custom aggregates.
Here there is a general information about the use of aggregates.

Is this approach applicable for your solution?

Kind regards,
Didie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Mike
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Share this question
or