cannot filter from code

1 Answer 19 Views
Grid
n/a
Top achievements
Rank 1
Iron
Iron
n/a asked on 31 Jan 2022, 04:27 PM

Hi,

I am trying to filter items from code and get this error:

cannot implicity convert type 'system.collections.generic.list<telerik.datasource.filterdescritptorbase>' to 'system.collections.generic.icollection<telerik.datasource.ifilterdescriptor>'>

Please see code below:

private async Task FilterByNameAndWritter()
        {
            List<FilterDescriptorBase> filterDescriptorBases = new List<FilterDescriptorBase>();
            filterDescriptorBases.Add(new FilterDescriptor() { Member = "Name", Operator = FilterOperator.Contains, Value = Name,    MemberType = typeof(string) });
            filterDescriptorBases.Add(new FilterDescriptor() { Member = "Writter", Operator = FilterOperator.Contains, Value = Writter, MemberType = typeof(string) });

            GridState<BookDto> gridState = new GridState<BookDto>();
            gridState.FilterDescriptors = filterDescriptorBases;  // the error comes from here

            await BookGrid.SetState(gridState);
        }

n/a
Top achievements
Rank 1
Iron
Iron
commented on 31 Jan 2022, 04:27 PM

any help would be appreciated. Thank you

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Feb 2022, 09:32 PM

Hello,

I recommend you start from the samples in the documentation for filtering the grid from code:

and if following the same pattern and using the same classes does not help you move forward,  I recommend opening a support ticket with a relevant, runnable sample that shows the issue.

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
n/a
Top achievements
Rank 1
Iron
Iron
Answers by
Marin Bratanov
Telerik team
Share this question
or