views:

21

answers:

1

I have the following code:

[code]

<h2>Listado General de Carreras</h2>

<% foreach (var item in Model)
   { %>

   <p><span class="titulo"><%=Html.ActionLink(item.Nombre, "Details" , new { id = item.ID }) %></span> <sub> Area: <%: item.Area.Nombre%></sub></p>

<% } %>    

<p>
    <%: Html.ActionLink("Crear Nueva Carrera", "Create") %>
</p>

[/code]

What I want to do is display a header for every Area in my database and under each area show what Careers the Area has.

How can I efficiently do this with MVC2?

I was thinking of using Linq querys and saving them to the ViewData[] but maybe there is another way?

A: 

have you tried the .Count property on the collection?

griegs