I'm using two DataContext objects to return seperate AsQueriable() datasets then joining the two using linq. The data construction works perfectly however when I pass that combined dataset to the view, I'm getting the error 'object' does not contain a definition for 'Name'.
During a debug session I can clearly see that both the parent Model and each 'item' in the foreach loop has all the data and keys visible/accessible. I'm very confused.
Many of the other q&a's on stackoverflow.com that match this problem don't solve my issue and as a result would appreciate a fresh set of eyes and hopefully a solution to this problem.
Many thanks! - code time:
The data construction
public ActionResult SplashImages()
{
var g = (from i in GetGallerySplash() join o in GetFestivals() on i.Festival equals o.ID orderby i.Rating descending select new {i.Photo, i.OwnedBy, i.Rating, o.Name });
Response.ContentType = "text/xml";
return View(g);
}
private IEnumerable<Gallery> GetGallerySplash()
{
GallerysDataContext gdc = new GallerysDataContext();
return (from i in gdc.Galleries orderby i.Rating descending select i).Take(15).AsQueryable();
}
private IEnumerable<Festival> GetFestivals()
{
FestivalsDataContext fdc = new FestivalsDataContext();
return (from i in fdc.Festivals select i).AsQueryable();
}
VSExpress's error screen:
Any guidance on a solution would be greatly appreciated. Thank you!
C