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

System.NullReferenceException whith VirtualQueryableCollectionView when GridViewDataColumn.AggregateFunctions

17 Answers 102 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
Jonx
Top achievements
Rank 2
Jonx asked on 03 Feb 2011, 11:10 PM

Hello,

I did use the code from the data virtualization context demo and adapted it (cut&paste) into my project.

It's working when using normal columns:

<telerik:GridViewDataColumn Header="Montant Total" DataMemberBinding="{Binding Path=TotalCalculated}" UniqueName="TotalCalculated" DataFormatString="{}{0:c}">
                    </telerik:GridViewDataColumn>

But as soon as I add aggregate functions I get NullReferenceException... Very hard to find errors...

<telerik:GridViewDataColumn Header="Montant Total" DataMemberBinding="{Binding Path=TotalCalculated}" UniqueName="TotalCalculated" DataFormatString="{}{0:c}">
                        <telerik:GridViewDataColumn.AggregateFunctions>
                            <telerik:SumFunction Caption="Total : " ResultFormatString="{}{0:C}" SourceField="TotalCalculated" />
                        </telerik:GridViewDataColumn.AggregateFunctions>
                    </telerik:GridViewDataColumn>

Any idea?

Thanks,

John.

17 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 04 Feb 2011, 10:26 AM
Hi John,

 We've fixed this immediately and the fix will be part of our next internal build (Monday) - I've added 2000 Telerik points to your account. 

Kind regards,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Tomas
Top achievements
Rank 1
answered on 09 Aug 2011, 12:32 PM
Hi,

So is this supposed to work now as I just tried it out and I get a NullReferenceException. I'm using the latest version Q2 2011 (2011.2 712).
I haven't tried this functionality before so I cannot say if it has worked here in between or not.

if it's still working for you can you please attach a simple example.

Thank you

Tomas
0
Yordanka
Telerik team
answered on 11 Aug 2011, 08:59 AM
Hello Tomas,

Please, find my sample project in the attached file. It uses the latest official binaries (Q2 2011) and I was not able to reproduce the mentioned exception. 
 
Regards,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Tomas
Top achievements
Rank 1
answered on 11 Aug 2011, 12:30 PM

Hi Yordanka,

I found the cause of the expcetion and that is filtering.

If you in codebehind add this line:

view.FilterDescriptors.Add(new FilterDescriptor("Quantity", FilterOperator.IsGreaterThanOrEqualTo, 3));

Or in Xaml add this:

<telerik:RadGridView.FilterDescriptors>
<telerik:FilterDescriptor Member="Quantity"
Operator="IsGreaterThanOrEqualTo"
Value="3" />
</telerik:RadGridView.FilterDescriptors>

Also if you do not specify either of the above and try to filter the grid at runtime the aggregate disappears but once you clear the filter it's displayed again.

Tomas

0
Yordanka
Telerik team
answered on 12 Aug 2011, 12:20 PM
Hello Tomas,

Thank you for the report.
We will investigate the problem and will contact you as soon as we have more information.
 
Best wishes,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Tomas
Top achievements
Rank 1
answered on 29 Sep 2011, 06:30 AM
Hi Yordanka,

Any news on this issue?
0
Yordanka
Telerik team
answered on 30 Sep 2011, 10:00 AM
Hello Tomas,

Setting MemberType property for the FilterDescriptor will solve the problem:

view.FilterDescriptors.Add(new FilterDescriptor() {
                Member="Quantity",
                Operator =FilterOperator.IsGreaterThanOrEqualTo,
                Value = 3,
                MemberType = typeof(int)
            });

 
All the best,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tomas
Top achievements
Rank 1
answered on 30 Sep 2011, 11:53 AM
Hi Yordanka,

This solves the nullref, but how do you specify the MemberType in XAML?

Also the aggregate in the footer still disappears once you filter.

Tomas
0
Yordanka
Telerik team
answered on 03 Oct 2011, 10:31 AM
Hi Tomas,

To assign MemberType in xaml you need to create a class where the type is exposed as a property and then bind it to the MemberType. This demo shows how you can set type in xaml.

As for the problem with aggregates - we identified an issue and it has been logged as a bug.
 
Best wishes,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jean-Francois
Top achievements
Rank 1
answered on 05 Oct 2011, 03:16 PM
Hi, do you have any workaround for this problem? We currently have this problem too but upgrading to the next release is not an option for us.

Thanks for your help.

Regards.
0
Vlad
Telerik team
answered on 05 Oct 2011, 03:36 PM
Hi Jean-Francois,

 Have you set MemberType?

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jean-Francois
Top achievements
Rank 1
answered on 05 Oct 2011, 03:39 PM
The MemberType property seems to apply to a FilterDescriptor only. 

In my case, we have this null reference exception when using the sum aggregate function.

Should i create a filter descriptor?

Thanks
0
Vlad
Telerik team
answered on 05 Oct 2011, 03:44 PM
Hi,

 Can you post the grid version?

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jean-Francois
Top achievements
Rank 1
answered on 05 Oct 2011, 03:45 PM
2010.3.1110.1040
0
Jean-Francois
Top achievements
Rank 1
answered on 05 Oct 2011, 09:32 PM
Ok, i found my problem, my SourceField was invalid. I was binding on the wrong name.

It Know works.

Thanks for your help.
0
Tomas
Top achievements
Rank 1
answered on 25 Nov 2011, 02:37 PM
Hi Yordanka,

The issue with aggregates disappearing from the footer once you filter is still present in 2011 Q3 release.
Do you have any public tracking of this bug?

Tomas
0
Yordanka
Telerik team
answered on 29 Nov 2011, 07:49 AM
Hello Tomas,

We resolved the issue and the fix for it will be part of the next internal build (next Monday).
 
Kind regards,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Data Virtualization
Asked by
Jonx
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Tomas
Top achievements
Rank 1
Yordanka
Telerik team
Jean-Francois
Top achievements
Rank 1
Share this question
or