I'm learning Linq and MVC2 I'm making progress, but I'm a little stuck on how I should get a page descrption into a View that uses a collection.
In my controller I have the following construct
public ActionResult Group(int id)
{
var result = (from d in db.ErrorDetails.Where(r => r.ErrorTerminal.ErrorTerminalGroupID == id)
orderby d.ErrorTerminal.TerminalNumber ascending, d.ErrorRecordedAt descending
select d);
return View(result);
}
and on my view
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>????? how to get a title from the 1st record?????</h2>
<table>
<%
foreach (var item in Model) {
%>
//code for setup of the rows etc
<% }%>
</table>
How do I get the Title from the Linq query that I made, OR do I need to make a ViewModel to house that?