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

[Solved] Q2 2011 - Broken Filter Descriptors

5 Answers 136 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Greg
Top achievements
Rank 1
Greg asked on 01 Aug 2011, 04:27 PM
I upgraded from v.2011.1.0419 (Q1 2011 SP1) to the Q2 2011 Release.  I have a few projects that have RadGrids where I am doing some filtering using FilterDescriptors in xaml as well as adding some FilterDescriptors programatically. Everything was working fine before i upgraded, but after the upgrade I get a NullReferenceException whenever I use one of these filter descriptors. I have run out of ideas of what could be wrong. Ill show some examples below:

<telerik:RadGridView   Name="myGridView" ItemsSource="{Binding Path=DataView}" CanUserDeleteRows="False" CanUserInsertRows="False" IsReadOnly="True" AutoGenerateColumns="False" IsBusy="{Binding IsBusy, ElementName=vesselDataSource}">
      <telerik:RadGridView.FilterDescriptors>
           <telerik:FilterDescriptor Member="Inactive" Operator="IsEqualTo" Value="False" />
       </telerik:RadGridView.FilterDescriptors>

this.lookupGrid.FilterDescriptors.Add(new Telerik.Windows.Data.FilterDescriptor("Deleted", Telerik.Windows.Data.FilterOperator.IsEqualTo, false));

here is the error:
Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Data.TypeExtensions.DefaultValue(Type type)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.DefaltValueExpression(Type type)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Type memberType)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Type memberType, Boolean liftMemberAccessToNull)
   at Telerik.Windows.Data.Expressions.PropertyAccessExpressionBuilder.CreateMemberAccessExpressionOverride()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateMemberAccessExpression()
   at Telerik.Windows.Data.Expressions.FilterDescriptorExpressionBuilder.CreateMemberExpression()
   at Telerik.Windows.Data.Expressions.FilterDescriptorExpressionBuilder.CreateBodyExpression()
   at Telerik.Windows.Data.FilterDescriptor.CreateFilterExpression(ParameterExpression parameterExpression)
   at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
   at Telerik.Windows.Data.CompositeFilterDescriptor.CreateFilterExpression(ParameterExpression parameterExpression)
   at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Data.CompositeFilterDescriptorCollection.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Data.ICompositeFilterDescriptorExtensions.GetFilterFunction(ICompositeFilterDescriptor filterDescriptors, Type itemType)
   at Telerik.Windows.Data.QueryableCollectionView.InitializeInternalList(IQueryable view)
   at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
   at Telerik.Windows.Data.QueryableCollectionView.GetEnumerator()
   at Telerik.Windows.Data.DataItemCollection.GetFlatEnumerator()
   at Telerik.Windows.Data.DataItemCollection.GetEnumerator()
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.EnsureItems()
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)     

I couldn't find any other known issues about this and I am out of ideas, If anyone could offer up any other ideas or any assistance i would be very grateful.

Thank you

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 02 Aug 2011, 08:24 AM
Hello Greg,

We believe that the issue you have found was fixed with out Latest Internal Build from yesterday, August 1st.

Could you please try with this new build and let us know if the problems still persist.

Thanks in advance.

Kind regards,
Ross
the Telerik team

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

0
Greg
Top achievements
Rank 1
answered on 18 Aug 2011, 06:16 PM
The Verson 2011.2.801.1040 doesn't seem to correct the problem. Any other suggestions?
0
Rossen Hristov
Telerik team
answered on 22 Aug 2011, 09:21 AM
Hi Greg,

In this case, I would like to ask you to prepare a dummy sample project that demonstrates this exception and attach it here. We will debug it in order to see what is going on.

If you want to be able to attach files here and in private support tickets and to receive premium 24 hour support, you will have to ask the license holder at your company to add you as a licensed developer under your company's account. 

We are looking forward to hearing from you.

All the best,
Ross
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Greg
Top achievements
Rank 1
answered on 26 Aug 2011, 01:22 PM
I was able to spend some more time going through and debugging what the issue is and think I understand what is going on for the most part. I will try to explain my situation and what i have found below.
 We have a RadGridView which has some Filter Descriptors defined both in the xaml and in the code behind. It also has some columns defined manually. The GridView has a binding to a RadDomainDataSource which is defined in the xaml. This source is set to AutoLoad ="false" and the DataContext is not defined in the xaml. It is defined in the code behind after some security authentication parameters are taken care of.

<telerik:RadDomainDataSource Name="myDataSource" AutoLoad="false" QueryName="GetMyData" />
  
<telerik:RadGridView  Name="myGridView" ItemsSource="{Binding ElementName=myDataSource, Path=DataView}" CanUserDeleteRows="False" CanUserInsertRows="False" IsReadOnly="True" AutoGenerateColumns="False" IsBusy="{Binding IsBusy, ElementName=myDataSource}">
    <telerik:RadGridView.FilterDescriptors>
        <telerikData:FilterDescriptor Member="MyName" Operator="IsEqualTo" Value="Greg" />
    </telerik:RadGridView.FilterDescriptors>
    <telerik:RadGridView.Columns>
         <telerik:GridViewDataColumn Header="My Name" DataMemberBinding="{Binging MyName}"/>
     </telerik:RadGridView.Columns>
</Telerik.RadGridView> 


void PermissionsValidLoadGrid()
{
    myDataSource.DomainContext = referenceContext;
    Telerik.Windows.Data.SortDescriptor sort = new Telerik.Windows.Data.SortDescriptor();
    sort.SortDirection = System.ComponentModel.ListSortDirection.Ascending;
    sort.Member = "MyName";
    vesselDataSource.SortDescriptors.Add(sort);
    vesselDataSource.Load();
}


We also have some additional filter descriptors which are added to the grid based off of some buttons on the screen.  Here is where the issues come in.  If I were to try to run this code with the filter descriptor defined in the xaml and the DomainContext and load command being defined in the code behind I get a null pointer exception. I expect this is because the filter descriptor being defined in the xaml is getting instantiated before the data has been loaded into grid. I say this because if i define the DomainContext in the xaml and set the RadDomainDataSource to AutoLoad="True" i don't get this null pointer. Also if I remove the filter descriptor that is defined in the xaml with the DomainContext and Load event taken care of in the code behind everything runs fine and the additional filter descriptors I have defined in the code behind that get added to the grid based off of button clicks work fine as well.

Since there are several filters defined in the code behind. I want to set a default one for when the grid is loaded for the first time. I tried adding a filter using the RadGridView DataLoaded event, RadGridView Loaded event, and RadDomainDataSource DataLoaded event and have run into runtime errors for all of them. I don't know if there was a bug that allowed me to define a FilterDescriptor and set the DomainContext in the code behind but this worked before the Q2 2011 version came out.

So I would like to be able to do the following:
  • Define The DomainContext in the code behind
  • issue the Load command to the RadDomainDataSource  in the code behing,
  • manually define the grid columns (not using the autoGenerateColumns)
  • have "default" filter on the grid when it is initially loaded
  • be able to change the filter settings based off of button clicks.

Any Suggestions on how I could achieve the desired functionality would be greatly appreciated.

Thank you in advance,
Greg
0
Jon
Top achievements
Rank 1
answered on 26 Aug 2011, 10:41 PM
Hi,

I am having the exact same problem using the latest build, however I have a more direct situation where we want a filter as they type RadMaskedTextBox passing its value into the grid collection.  The error is as below as well as a code snippet

EDIT:  I was able to resolve this issue as we were pointing to the wrong object member to filter on.  Please disregard.  I would like to request that the error message for a missing filter member would be clearer.

Thanks,

Jon
Tags
GridView
Asked by
Greg
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Greg
Top achievements
Rank 1
Jon
Top achievements
Rank 1
Share this question
or