Estoy intentando llenar un menú desplegable en mi vista. Cualquier ayuda es muy apreciada. Gracias.LINQ to Entities solo admite el moldeado de tipos primitivos de Entity Data Model?
error:
Unable to cast the type 'System.Int32' to type 'System.Object'.
LINQ to Entities only supports casting Entity Data Model primitive types.
controlador:
ViewBag.category = (from c in new IntraEntities().CategoryItems
select new SelectListItem() {Text=c.Name, Value=""+c.ID }).ToList<SelectListItem>();
Vista:
Category:<br />@Html.DropDownList("category", (List<SelectListItem>)ViewBag.category)
Linq to enitites no es compatible con este tipo de conversiones convert.Tostring() y convert.ToDatetime() .. –