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

Footer aggregate causes "Specified Cast is not valid." exception

4 Answers 286 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mlandauer
Top achievements
Rank 1
mlandauer asked on 19 Sep 2008, 12:38 AM
Whenever I try to set Aggregate="Sum" for an integer column, I get the "Specified Cast is not valid." exception.  I've tried all kinds of things, but always get the exception.   It works fine with Decimal columns.

These cause an exception:

<rad:GridNumericColumn DataField="EstQty" HeaderText="Est. Qty." 
            UniqueName="EstQtyColumn" Aggregate="Sum" NumericType="Number" 
            DataType="System.Int32" DataFormatString="{0:N0}">  
     <HeaderStyle HorizontalAlign="Center" /> 
     <ItemStyle Width="6em" /> 
</rad:GridNumericColumn> 
<rad:GridNumericColumn DataField="FinalQty" HeaderText="Final Qty." 
            UniqueName="FinalQtyColumn" Aggregate="Sum" NumericType="Number" 
            DataType="System.Int32" DataFormatString="{0:N0}">  
     <HeaderStyle HorizontalAlign="Center" /> 
     <ItemStyle Width="6em" /> 
</rad:GridNumericColumn> 
 

While this works fine:

<rad:GridNumericColumn DataField="Postage" HeaderText="Postage" UniqueName="PostageColumn" 
            NumericType="Currency" DataType="System.Decimal" Aggregate="Sum" 
            FooterAggregateFormatString="{0:C}">  
     <HeaderStyle HorizontalAlign="Center" /> 
     <ItemStyle HorizontalAlign="Right" /> 
</rad:GridNumericColumn> 

I'm using Q2 2008 SP1, btw.

4 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 19 Sep 2008, 06:35 AM
Hello mlandauer,

Please set EnableLinqExpressions to false and let me know about the result.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
mlandauer
Top achievements
Rank 1
answered on 19 Sep 2008, 03:22 PM
That fixed the problem.  Thank you.
0
miksh
Top achievements
Rank 1
Iron
answered on 30 Sep 2008, 09:17 PM
I had the same issue and turning EnableLinqExpressions off hepled me as well.
Are you going to fix it in next release?
0
Vlad
Telerik team
answered on 01 Oct 2008, 05:58 AM
Hello,

There are two similar issues in this scenario - one of them is already fixed (.NET 3.5 SP1 change) and we will do our best to fix the other one (LINQ on DataTable, DataView or DataReader).

In the meantime if you bind the grid to one of the old ADO.NET data objects please turn of the grid LINQ expressions.

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
mlandauer
Top achievements
Rank 1
Answers by
Vlad
Telerik team
mlandauer
Top achievements
Rank 1
miksh
Top achievements
Rank 1
Iron
Share this question
or