Posted on: 10/19/2015 9:47:33 AM | Views : 1234

I need to populate a SelectList using a WHERE clause in an MVC 5 EF 6 web app. At the moment I've got this line pulling all records in the specified field from a database:
ViewBag.UserID = new SelectList(db.users, "ID", "ComputerID",db.computers); This is then added to the view using a DropDownList. I have another table (projects) linked to both of the above containing ProjectID and I need to filter where the records are associated to the selected project.
Any ideas?
Thanks in advance Adam

Go to the complete details ...