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

Filter Descriptor Limit?

2 Answers 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nick Anderson
Top achievements
Rank 1
Nick Anderson asked on 06 Jan 2012, 03:52 PM
Is there a limit to the number of FilterDescriptors that can be added to the FilterCollection? I seem to be receiveing a StackOverflowException in System.Core.dll if i try to add a significant number.

I need to limit the records in my Grid based upon specific ID numbers, so I am trying to add a filter desciptor for each ID to have it show only those records. My Grid has about 53,000 records, and in one example, I have 17,151 records that I need to display. How can I handle this? It works if i don't have a large number of results (i'm unsure of what the record limit before i get the error is)

I am just declaring a filter descriptor like this:
Dim filterDescriptor As New FilterDescriptor("ID", FilterOperator.IsEqualTo, id)
And then adding it to the collection

2 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 06 Jan 2012, 04:03 PM
Hello,

It's not the FilterDescriptors that have a limit. We build a LINQ Where expression from them and LINQ Expressions have their limits apparently.

You can use different filters which use the operators IsGreaterThan or IsLessThan. The general idea would be to "cover" as many data items with one FilterDescriptor in order to avoid this .NET Framework limitation which we can't do anything about unfortunately.

In other words, if you were using pure LINQ, i.e. from myItems select item where ???

how would you construct the where part. There must be a more concise way to express the where clause. FilterDescriptors do the same -- they express the Where clause.

I hope this helps.

All the best,
Ross
the Telerik team

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

0
Nick Anderson
Top achievements
Rank 1
answered on 09 Jan 2012, 08:16 PM
Okay thanks. Instead of using the FilterDescriptors, I just decided to re-query the data and refill the grid with only the records i wanted.
Tags
GridView
Asked by
Nick Anderson
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Nick Anderson
Top achievements
Rank 1
Share this question
or