The simple solution is to add a .ToList() before your select(...).
ViewDet = _db.Grp.ToList().Select(gh => new MultiDetailViewModel ...)
That way the initial request will go to the database, come back with the results and you can then reproject them using a select statement against Linq to objects.
But I have to ask why there isn't an FK relationship between the groups and the texts and thus an Entity Association between the two allowing you to just access gh.GrpText
and get to the collection of texts lazily loaded (or eagerly loaded using .Include()).
Hightechrider
2010-08-21 06:15:46