I am using the following line to get a column sum:
columns.Bound(item => item.McGross).Width(50).Title("Amount"开发者_开发知识库).Aggregate(aggreages => aggreages.Sum()).Format("{0:c}").FooterTemplate(result =>
{ %><%= result.Sum.Format("{0:c}") %><% });
I get error when any of the column valuse are null. How can I use "if" null put "0" for that record. Thanks in advance.
The good people at Telerik has provided an answer, here it is:
.FooterTemplate(result =>
{
%>Total Sum: <%=
(result.Sum == null || (double)result.Sum.Value == 0.0)
? "Value not available"
: result.Sum.Format("{0:c}")
%><%
});
It worked. Hope this could help someone else.
精彩评论