сначала я создал модель
Код: Выделить всё
public class common
{
public Artist Artist { get; set; }
public Album Album { get; set; }
public Genre Genre { get; set; }
}
Код: Выделить всё
public ActionResult Show1()
{
var query = from a in DB.Album
join b in DB.Artists
on a.ArtistId equals b.ArtistId
join c in DB.Genre
on a.GenreId equals c.GenreId
where (b.ArtistId == 2)
select new common { Album = a, Artist = b, Genre = c };
return View(query.ToList());
}
}
Код: Выделить всё
@model IEnumerable
@{
ViewBag.Title = "Show1";
}
Show1
@{
var grid = new WebGrid(Model, defaultSort:"Name");
}
@grid.GetHtml()
Как я могу это сделать?
Подробнее здесь: https://stackoverflow.com/questions/123 ... n-gridview
Мобильная версия