i need some help with the following.
i get a list of objects from the Entity Framework data context.
var list = context.EntityA;
the EntityA is the main object (contains the primary key), but has a navigation property called "EntityALanguages", which contains language specific properties.
now i want to bind the list to a dropdownlist and need so set DataValueField and DataTextField properties from the dropdownlist.
how can i set the DataTextField to a property of a navigation property, something like:
this.ddl.DataValueField = "GUID";
this.ddl.DataTextField = "EntityALanguages.ShortDescription";
Edit: The navigation property "EntityALanguages" is a collection, so EntityA -> EntityALanguages is a 1-n relation
By using
var list = context.EntityA;
your navigation properties will be lazy loaded. Tryvar list = context.EntityA.Include("EntityALanguages");
so your navigation propery will be present.