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

[Solved] NullReferenceException when using Aggregate

0 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Philip Fourie
Top achievements
Rank 1
Philip Fourie asked on 18 Mar 2012, 07:46 AM
I am getting a NullReferenceException when using the following code.

columns.Bound(o => o.NormalHours)
     .Aggregate(a => a.Sum()).FooterTemplate(@<text>@item.Sum.Format("{0:0.0}")</text>);

It only happens when the data source I am binding to does not have any elements.
How do I prevent the NullReferenceException from occurring in such a case?

I am using 2012.1.214

Thank you,
Philip
Tags
Grid
Asked by
Philip Fourie
Top achievements
Rank 1
Share this question
or