views:

38

answers:

1

I have an entity that has a 1-to-many relationship with another ( Entity Position has One Department).

In the details view I'm showing in s combobox a list of all the departments available and I want to start the selecteditem in the combo is the department to which the entity is related.

The problem is than I am using layers so the Position context it is different to the context of the list of departments and when I do something like:

comboBoxDepartments.SelectedItem = Position.Departament

does not work, how can I make a comparison of the items of an entity with a different context?

A: 

If the entities have a unique identity, then compare the identity. If there's another unique column (name, for instance) that is NOT NULL, then you could compare that.

Otherwise, see http://stackoverflow.com/search?q=Compare+2+Entities.

John Saunders