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

CalculateAggregates throws InvalidCastException

2 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas LEBRUN
Top achievements
Rank 1
Thomas LEBRUN asked on 29 Jan 2010, 02:57 PM
Hi,

On my grid, I'm using load date from Analysis Server and call CalculateAggregates to display sum. This works fine but when I specified myself the DataType of the column, I get the following error:

InvalidCastException: The specified cast is not valid.

With the following stacktrace:
   à lambda_method(ExecutionScope , DataRowContainer )
   à System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   à System.Linq.Enumerable.Sum(IEnumerable`1 source)
   à lambda_method(ExecutionScope , IGrouping`2 )
   à System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   à Telerik.Windows.Data.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
   à Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
   à Telerik.Windows.Controls.GridView.GridViewDataControl.CalculateAggregates()
   à Total.Book.IHM.SL.GridActions.SLGrid2.SetFooter()

How can I fix that ?

For information, here is my DataRowContainerClass which don't work:

[

DataContract]

 

 

public class DataRowContainer

 

{

[

DataMember]

 

 

public List<RowID> RowID { get; set; }

 

[

DataMember]

 

 

public object[] RawData { get; set; }

 

}

The RawData property contains the content of the row and I'm sure, after checking, that the Double column have only doubles values.


Any ideas ?


Thanks !

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Feb 2010, 12:38 PM
Hello,

You will get such exception when the data type does not match the specified type.

Sincerely yours,
Vlad
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 03 Feb 2010, 01:35 PM
Hi Vlad,

Yes, I know this but it looks like the data type mathes correctly. I've send a support ticket: i'll give another try and will let you know the state.


Thanks !
Tags
GridView
Asked by
Thomas LEBRUN
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Thomas LEBRUN
Top achievements
Rank 1
Share this question
or