Raddropdownlist filter with different items and the same display value

1 Answer 85 Views
DropDownList
Zygmunt
Top achievements
Rank 1
Iron
Iron
Iron
Zygmunt asked on 08 Mar 2022, 08:25 AM

Hello,

I have Raddropdownlist control with list of items. Some of the items have the same display value but whole objects are different. DropDownListElement.AutoCompleteSuggest.SuggestMode property is set on SuggestMode.Contains value. When I use filter for descripted situation I get list of items (number of items is correct) but all position on filtered list is pointing on the same item (selected indexes alsow are the same). Could you tell my what can I do to get correct filtering result for this situation?

 

All the best

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Mar 2022, 07:01 AM
Hello, Zygmunt,

Following the provided information, I have prepared a sample project to test the behavior on my end with the latest version of the Telerik UI for WinForms suite. Here is the sample code snippet for your reference:
            DataTable dt = new DataTable();
            dt.Columns.Add("Title", typeof(string));
            dt.Columns.Add("Id", typeof(int));

            dt.Rows.Add("Kiwi", 1);
            dt.Rows.Add("Apple", 2); 
            dt.Rows.Add("Apple", 3); 
            dt.Rows.Add("Apricot", 4);

            this.radDropDownList1.DisplayMember = "Title";
            this.radDropDownList1.ValueMember = "Id";
            this.radDropDownList1.DataSource = dt;
            this.radDropDownList1.AutoCompleteMode = AutoCompleteMode.Suggest;
            this.radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;

When the autocomplete functionality is used, e.g. after typing "a", the respective items are displayed. There are two items with the same title "Apple", but different id. Thus, the SelectedIndex is properly managed when selecting one of the "Apple" items. The following gif file illustrates the observed behavior on my end:

Am I missing something? I have attached my sample project. Please give it a try and see how it works on your end. Am I missing something? Could you please specify the exact steps how to reproduce the problem?

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DropDownList
Asked by
Zygmunt
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or