KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to populate a dropdown in my view. Any help is greatly appreciated. Thanks. Error: Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types. Controller: ViewBag.category = (from c in new IntraEntities().CategoryItems select new SelectListItem() {Text=c.Name, Value=""+c.ID }).ToList<SelectListItem>(); View: Category:<br />@Html.DropDownList("category", (List<SelectListItem>)ViewBag.category)
Tags (comma-separated)
Save Edits
Cancel