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

Problem with Aggregate="Sum"

2 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Katte
Top achievements
Rank 1
Katte asked on 15 Sep 2010, 09:12 AM
Hi,

I have the following lines in my page.

 //Gives Error

<telerik:GridNumericColumn Aggregate="Sum" DataField="SubDetails.Value" HeaderText="Mon" UniqueName="Mon" 

 

ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" HeaderStyle-Wrap="true" />

//Working perfectly

 

 

 

<telerik:GridNumericColumn Aggregate="Sum" DataField="Units" HeaderText="Tue" UniqueName="Tue"  

 

 

ItemStyle-HorizontalAlign="Center" HeaderStyle-Wrap="true" />

It gives me the following error

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotSupportedException: Average is not supported for type "System.Object" at Telerik.Web.UI.GridBoundColumn.GetAggregateByType[T](IQueryable queryable, String fieldName, GridAggregateFunction func)

public Class Details1
{
        public int Value { get; set }
}

public Class Details2
{
        public int ID{ get; set }
        public Details1 SubDetails { get; set }
}


Kindly guide me to solve this problem.

Thanks
Katte

 

 

2 Answers, 1 is accepted

Sort by
0
Katte
Top achievements
Rank 1
answered on 15 Sep 2010, 01:42 PM
Telerik Team,

Kindly tell me to solve this issue.

Thanks,
Katte
0
Veli
Telerik team
answered on 20 Sep 2010, 02:49 PM
Hello Katte,

Using Aggregates with nested properties are not supported. The advised approach is to create a first-level property in class Details2 that maps to the SubDetails.Value inner property.

Veli
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
Grid
Asked by
Katte
Top achievements
Rank 1
Answers by
Katte
Top achievements
Rank 1
Veli
Telerik team
Share this question
or