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

IEnumerable Datasource Error

1 Answer 43 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 16 Mar 2011, 11:31 PM
Hi,

We're just implementing Telerik controls in our WPF (PRISM) application and having some problems with the DataFilter control.
We have a radgrid and can bind the control to the grid and filter without any problems. However, the requirement is display 3 filterable fields when the screen loads and for only 3 fields out of a possible 8 of the grid view.

So we're trying to go down the FilterDescriptions route and define our 3 filters programatically

                var companyFilter = new FilterDescriptor("Receiver Company", FilterOperator.Contains, "", true);
            radDataFilter.FilterDescriptors.Add(companyFilter);
 
            var addressFilter = new FilterDescriptor("Address Line 1", FilterOperator.Contains, "", true);
            radDataFilter.FilterDescriptors.Add(addressFilter);
 
            //// DateTime filter.
            var dateFilter = new FilterDescriptor("Created Date", FilterOperator.IsGreaterThan,
                                                 new DateTime(2007, 5, 1));
            radDataFilter.FilterDescriptors.Add(dateFilter);

However when we do this it throws an error saying the source isn't IEnumerable. The source in this instance is defined in the XAML as the radgrid, which has loaded an IList<Receiver> object, which last time I checked was IEnumerable.

Even if I set the Datasource programatically to a List<Receiver> still get the same error.

I'm not sure where to turn and thinking maybe Data annotations are an option.

Any views?

Thanks.


1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 17 Mar 2011, 10:17 AM
Hello Lee,

When you say that the member is called "Address Line 1", do you think that RadDataFilter can find what to filter on?

I believe that you are confusing ItemPropertyDefinitions with FilterDescriptors.

Greetings,

Ross
the Telerik team
Tags
DataFilter
Asked by
Lee
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or