I am facing the problem that I cannot properly map my foreign key table values to an asp.net mvc edit view.
I have placed a Html.DropDownList and made an IENumerable/IQueryable helper function returning:
from item in db.items select item.name
which populates my Html.DropDownList with all the Names in the foreign key table but has nothing in the value field.
But how can I make the DropDownList to show the Names but let the Value field be the ID field of that foreign key table?
Change the linq-query as follows:
Then create a selectlist as follows:
and pass that selectlist to the dropdownlist