In my data, I have multiple identical values for the TextField of the ComboBox. When the user selects one of them and focuses away from the component the selected value changes to the first instance of the items with the same TextFields, although they have different ValueFields.
Reproduction:
<TelerikComboBox Data="@myDdlData"
TextField="MyTextField"
ValueField="MyValueField"
Value="selectedValue"
ValueChanged="@((int? id) => ValueChangedHandler(id))"
FilterOperator="StringFilterOperator.Contains"
Filterable="true">
</TelerikComboBox>
@code {
private List<MyDdlModel> myDdlData { get; set; }
private void ValueChangedHandler(int? id)
{
selectedValue = id;
}
public class MyDdlModel
{
public int? MyValueField { get; set; }
public string MyTextField { get; set; }
}
int? selectedValue { get; set; }
protected override void OnInitialized()
{
myDdlData = new List<MyDdlModel>()
{
new MyDdlModel()
{
MyValueField = 1,
MyTextField = "John Smith"
},
new MyDdlModel()
{
MyValueField = 2,
MyTextField = "John Smith"
},
new MyDdlModel()
{
MyValueField = 3,
MyTextField = "John Smith"
},
new MyDdlModel()
{
MyValueField = 4,
MyTextField = "Alice Jones"
},
new MyDdlModel()
{
MyValueField = 5,
MyTextField = "Alice Jones"
},
};
}
}