I’m facing a weird problem. As shown in the image actually I selected record number 37 but lightswitch is highlighting as record number 1.
1) The FristName,LastName & HospitalName are unique indexes in the table Doctors since each doctor can have multiple addresses.
2) I’m validating this drop down field as below to avoid user from selecting doctors who are not part of the hospital patient belongs to.
partial void DoctorsMasterItem_Validate(EntityValidationResultsBuilder results)
{
if (this.DoctorsMasterItem != null)
{
if (this.HospitalName != this.DoctorsMasterItem.HospitalName)
{
results.AddPropertyError("Make Sure the Hospital Patient belongs to and Doctor is also part of that hospital else your letters address would be wrong");
}
}
}
The data model is

A better approach would be to filter the dropdown box, so the user isn’t presented with invalid choices.
Have a look at these two articles. This is what I believe you should be doing, nested (or cascading) comboboxes:
Nested AutoCompleteBox For Data Entry
Nested AutoCompleteBox for data entry Part 2