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

RadGrid throws an error "Specified cast is not valid. " on grouping

1 Answer 348 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter From LA
Top achievements
Rank 1
Peter From LA asked on 25 Jan 2014, 10:54 PM
I have a grid displaying some data.
The columns are dynamically generated in code behind.
The grid allows for grouping.
The grid has a footer displaying aggregates for columns with numeric values.

When I have a column displaying FLOAT values, and I try to group by any column I get "Specified cast is not valid." error.
If I remove the aggregates, the grouping works.

This is the full text of the error:

Specified cast is not valid.
Anonymously Hosted DynamicMethods Assembly
at lambda_method(Closure , DataRow ) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Sum(IEnumerable`1 source) at lambda_method(Closure ) at System.Linq.EnumerableExecutor`1.Execute() at System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression) at System.Linq.Queryable.Sum(IQueryable`1 source) at Telerik.Web.UI.GridBoundColumn.GetAggregateByType[T](IQueryable queryable, String fieldName, GridAggregateFunction func)

Any assistance in pointing me in the right direction would be greatly appreciated

1 Answer, 1 is accepted

Sort by
0
Peter From LA
Top achievements
Rank 1
answered on 25 Jan 2014, 11:14 PM
Solved, I think...

I was setting the data type of the column as "System.Decimal", and I switched to "System.Double" the grouping started  working as expected...

I will keep an eye on it and if this is not the solution, I will post the info here...
Tags
Grid
Asked by
Peter From LA
Top achievements
Rank 1
Answers by
Peter From LA
Top achievements
Rank 1
Share this question
or