Using ASP MVC and Entity Framework. In the view, you have a page declaration that specifies the model for this view will be a collection implementing IEnumerable. Let's say that collection holds Car objects, that are only from Ford (Ford being the Category).
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<detelete.Models.Car>>" %>
This list of Ford cars only, was generated via a LINQ to Entities query. The EF object thingee is aware of the relationship of Cars to Manufacturers (which I call the category)
var dat = ent.CarSet.Where(m => m.Manufacturer.Name == nm);
List<Car> cars = dat.ToList<Car>();
return View("ListingByManufacturer", cars);
So, in the view I display the list of cars that are all Ford's. I have the view displaying all the cars properties correctly, but there isn't a way to show what category (manufacturer in this example) the cars are from. I have seen some EF/MVC examples that have two foreach loops, and the top one displays the manufacturer - but that feels klugey.
Seems like it should be simple, but I am stuck...