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

FilterMemberProvider func not called

2 Answers 43 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Carol
Top achievements
Rank 1
Carol asked on 16 Apr 2015, 04:08 PM

I am trying to get the RadAutoCompleteBox to provide an unfiltered list in certain scenarios, such as when the control initially gets the focus and the current value is not in the list.  I am experimenting with the FilterMemberProvider, and it's not working as I expected.

 Just for testing purposes, I have the following code in my custom control derived from RadAutoCompleteBox:

            this.FilterMemberProvider = CustomFilterBehavior;

...

         public string CustomFilterBehavior(object obj)
        {
            return "Test";  

            // actual intention is to return this.Text in certain scenarios to prevent filtering,

           // and normal filter value in other scenarios
        }

This test code has not changed the behavior of my control at all -- it still filters normally.  I put a breakpoint in the CustomFilterBehavior method, and see that it is never called.  I have tried setting the FilterMemberBehavior in the constructor of my control or in OnLoaded; and get the same result.

Is there something else I need to do to use the FilterMemberProvider?

Or is there a better way to force the suggestions control to show an unfiltered list in certain scenarios?

Thanks

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosy Topchiyska
Telerik team
answered on 20 Apr 2015, 02:12 PM
Hello Carol,

Thank you for contacting us.

There are two problems with your scenario. The first problem is that FilterMemberProvider is called once per item and after that the provided value is used. The second problem: when you clear the content of the TextBox, the suggestions list is empty.

To change the default filtering behavior, you will have to create your own text search provider by implementing the ITextSearchProvider interface and then call the RadAutoCompleteBox.InitializeSuggestionsProvider() method with your provider as a parameter.

You can use the RadAutoCompleteBox.IsDropDownOpen property to display the suggestions list.
 
I hope this helps. Please, let us know if you have further questions.

Regards,
Rosy Topchiyska
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Carol
Top achievements
Rank 1
answered on 20 Apr 2015, 04:32 PM
Thank you for pointing me in the right direction.
Tags
AutoCompleteBox
Asked by
Carol
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Carol
Top achievements
Rank 1
Share this question
or