System.NullReferenceException whith VirtualQueryableCollectionView when GridViewDataColumn.AggregateFunctions

18 posts, 1 answers
  1. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 03 Feb 2011 Link to this post

    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.

  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Feb 2011 Link to this post

    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>>
  3. DevCraft banner
  4. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 09 Aug 2011 Link to this post

    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
  5. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 11 Aug 2011 Link to this post

    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 >>

  6. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 11 Aug 2011 Link to this post

    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

  7. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 12 Aug 2011 Link to this post

    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 >>

  8. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 29 Sep 2011 Link to this post

    Hi Yordanka,

    Any news on this issue?
  9. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 30 Sep 2011 Link to this post

    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 >>

  10. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 30 Sep 2011 Link to this post

    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
  11. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 03 Oct 2011 Link to this post

    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 >>

  12. Jean-Francois
    Jean-Francois avatar
    4 posts
    Member since:
    Nov 2010

    Posted 05 Oct 2011 Link to this post

    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.
  13. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Oct 2011 Link to this post

    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 >>

  14. Jean-Francois
    Jean-Francois avatar
    4 posts
    Member since:
    Nov 2010

    Posted 05 Oct 2011 Link to this post

    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
  15. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Oct 2011 Link to this post

    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 >>

  16. Jean-Francois
    Jean-Francois avatar
    4 posts
    Member since:
    Nov 2010

    Posted 05 Oct 2011 Link to this post

    2010.3.1110.1040
  17. Jean-Francois
    Jean-Francois avatar
    4 posts
    Member since:
    Nov 2010

    Posted 05 Oct 2011 Link to this post

    Ok, i found my problem, my SourceField was invalid. I was binding on the wrong name.

    It Know works.

    Thanks for your help.
  18. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 25 Nov 2011 Link to this post

    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
  19. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 29 Nov 2011 Link to this post

    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 >>

Back to Top
DevCraft banner