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

RadDataPager + RadGridView + FilterDescriptor throw error

9 Answers 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Phong
Top achievements
Rank 1
Phong asked on 26 Apr 2012, 12:24 PM
  • I'm using SL5, MVVM and telerik ver: 2012.1.227.1050
  • This is my xaml, it have  RDPager, RGV  , default will sort by column "Time" and just show Status contain "Error". User can clear this filter to view other items. 
  • App throw error when have both RadDataPager and FilterDescriptors, when I remove one of them app will work correctly.

<telerik:RadDataPager PageSize="50" Source="{Binding Items, ElementName=GridView}"
                       DisplayMode="FirstLastPreviousNextNumeric, Text"
                         IsTotalItemCountFixed="True" />    
 <telerik:RadGridView x:Name="GridView" ItemsSource="{Binding List}" IsBusy="{Binding IsBusy}"                       
                             IsReadOnly="True" AutoGenerateColumns="False" IsFilteringAllowed="True"
                             ShowGroupPanel="False" EnableColumnVirtualization="True" EnableRowVirtualization="True" ShowColumnFooters="False"
                             RowIndicatorVisibility="Collapsed" CanUserInsertRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" GridLinesVisibility="Both" FrozenColumnCount="3">            
            <telerik:RadGridView.SortDescriptors>
                <telerik:SortDescriptor Member="Time" SortDirection="Descending" />
            </telerik:RadGridView.SortDescriptors> 
          
            <telerik:RadGridView.FilterDescriptors>
                <telerik:FilterDescriptor IsCaseSensitive="True"
                                  Member="Status"
                                  Operator="Contains"
                                  Value="Error"/>
            </telerik:RadGridView.FilterDescriptors> 

            <telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Status" DataMemberBinding="{Binding Status}" />
<telerik:GridViewDataColumn />.....
  
And my app throw this 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.Expressions.OperatorValueFilterDescriptorExpressionBuilderBase.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)    


Is there a way to use both of them?

Thank you in advance! 
Phong

9 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 30 Apr 2012, 08:40 AM
Hello,

Unfortunately, we were unable to reproduce this issue on our side.

Can you please send us a runnable sample project that reproduces this behavior. Once we have a runnable sample project that we can run and debug, we will be able to provide you with more information.

We are looking forward to hearing from you.

Regards,
Ross
the Telerik team

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

0
Phong
Top achievements
Rank 1
answered on 02 May 2012, 05:49 AM
Hi Ross
Please help check my sample proj 


Thank you in advance! 
Phong 
0
Rossen Hristov
Telerik team
answered on 02 May 2012, 10:28 AM
Hi,

Add this line of code after InitializeComponent and it will start working.

public MainPage()
{
    InitializeComponent();
 
    this.StatusGridView.FilterDescriptors.OfType<FilterDescriptor>().First().MemberType = typeof(string);
}

Since data this comes from a service, you have to "help" the FilterDescriptor by manually specifying the MemberType.

Greetings,
Ross
the Telerik team

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

0
Phong
Top achievements
Rank 1
answered on 03 May 2012, 05:11 AM
Hi Ross,
It work . 
But it just show only items contain "error" in "select all" zone (we can't chose to filter other items like "alpha..") and not show the value "Error" on the "Show rows with value that" zone.

Any idea? Ross
Thank you so much!
0
Accepted
Rossen Hristov
Telerik team
answered on 03 May 2012, 08:20 AM
Hi,

Please, read these two help articles:

Programmatic Filtering -> you have to perform column filtering if you want the UI to show your settings.
How to display all distict values -> you can tell the filtering UI to display absolutely all distinct values.

They should answer your question. Let me know if something is unclear.

Greetings,
Ross
the Telerik team

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

0
Phong
Top achievements
Rank 1
answered on 03 May 2012, 10:26 AM
Hi Ross,

Two articles above very helpful, and all my problems were solved .

Thank you for your time! Ross.
Phong

 
0
Tingting
Top achievements
Rank 1
answered on 25 Oct 2012, 05:39 PM
Hello 

In the SilverLight Bussiness Application i used FilterDescriptor for filtering the data.  Since this action is sometimes slow, i want to know if it is possible to display a "Waiting icon" as cursor or hourglass during this filtering action.

Thank you
 
0
Victor
Top achievements
Rank 1
answered on 01 Nov 2012, 03:59 PM
Rossen,

How can I achieve the same thing as you propose with the most recent release of the Telerik SL libraries? It seems that the MemberType property is no longer exposed...

Thanks!
0
Rossen Hristov
Telerik team
answered on 02 Nov 2012, 08:52 AM
Hi,

FilterDescriptor.MemberType is public and has always been so.

Exactly what are you trying to achieve, since this thread discusses many different issues?

Did you check our online documentation?

Greetings,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Phong
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Phong
Top achievements
Rank 1
Tingting
Top achievements
Rank 1
Victor
Top achievements
Rank 1
Share this question
or