Quick question about filtering. I have a ListView with several columns including a checkbox column. I want to filter the listview on one column ("Title'), based on a textbox value as the user types. I thought the below might work, but it doesn't seem to work, the filtering doesn't look right. Please tell me why this approach doesn't work. Thanks.
Code to add the filter:
private FilterDescriptor _valueFilter;_valueFilter = new FilterDescriptor("Title", FilterOperator.Contains, "");lstvwLookups.FilterDescriptors.Add(_valueFilter);
Code to update the filter:
private void txtFilter_TextChanged(object sender, EventArgs e){ _valueFilter.Value = ((TextBoxChangedEventArgs)e).Text;}6 Answers, 1 is accepted
I am glad that the problem you were facing is now resolved. Additional information about the filtering functionality in RadListView is available in the following help article: https://docs.telerik.com/devtools/winforms/listview/features/filtering
You can also have a look at the Demo application >> ListView >> First look example which provides a filter box as well.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
In the Demo application >> ListView >> First look example there is a filter box which demonstrates a filter as you type example which uses the FilterDescriptor instance to perform filtering.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
Hi,
I have tried this following code to filter the listview on Enter event of the textbox. But it's not filtering. Can you please help to resolve please?
Private Sub radTxtSearch_KeyDown(sender As Object, e As KeyEventArgs) Handles radTxtSearch.KeyDown If e.KeyCode = Keys.Enter Then radLstDetails.EnableFiltering = True Dim typeFilter As New FilterDescriptor("Column 4", FilterOperator.Contains, radTxtSearch.Text) radLstDetails.FilterDescriptors.Add(typeFilter) radLstDetails.ListViewElement.DataView.Refresh() End If End SubHello, Arun,
Following the provided code snippet I have prepared a sample project to test the behavior on my end. Filtering RadListView works as expected. Please refer to the attached gif file. However, I have added clearing the FilterDescriptors collection before adding a new FilterDescriptor.Please give the attached sample project a try and see how it works on your end.
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
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/.
