Search code examples
asp.net-mvcviewstrong-typinglinq-group

linq groupby in strongly typed MVC View


How do i get an IGrouping result to map to the view?

I have this query:

var groupedManuals = manuals.GroupBy(c => c.Series);
return View(groupedManuals);

What is the proper mapping for the ViewPage declaration?

Inherits="System.Web.Mvc.ViewPage<IEnumerable<ProductManual>>"

Solution

  • I am still in the early stages of learning Linq so I may be wrong but I think that that ViewPage will need to be something like

    Inherits="System.Web.Mvc.ViewPage<IEnumerable<IGrouping<Series, Manual>>>