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

Combobox with duplicate display member values.

1 Answer 251 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alistair Wardlaw
Top achievements
Rank 1
Alistair Wardlaw asked on 11 Jan 2010, 04:23 AM
Currently using a RadComboBox which is databound from a linq query.

The ValueMember is a unique ID and DisplayMember is a user entered field.

If the user enters duplicate values for the "name" field, both will display in the combo box, however SelectedValue will always return the first matching name in the list - even if the underlying ID's are different.

Is this by design or is it a bug?


1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 12 Jan 2010, 01:11 PM
Hello Alistair Wardlaw,

Thank you for writing.

I am afraid that I could not reproduce the behavior you described.

Here is the code snippet I am testing with:

List<CustomObject> ds = new List<CustomO
 
ds.Add(new CustomObject("1", 5));
ds.Add(new CustomObject("1", 1));
 
this.radListBox1.DisplayMember = "Name";
this.radListBox1.ValueMember = "Value";
this.radListBox1.DataSource = ds;

 

There are two objects with identical display values ("1") but different values for ValueMember (5 and 1).

Calling SelectedValue.ToString() always returns the correct result based on the selection.

Please explain in more details how to reproduce the issue or send a sample application which demonstrates it if possible.

I am looking forward to your reply.

Greetings,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Alistair Wardlaw
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or