Missing Model Genre

Aug 25, 2010 at 12:34 AM

I get an error when Site.Master is trying to display GenreMenu from Store. I think this is because GenreMenu.ascx is looking for a model called Genre. This seems to be missing from the download.

Great tutorial, I have almost completed it and I have hours of interesting study left to review how the code all hangs together.

 

Many thanks

 

Chris

Coordinator
Aug 25, 2010 at 12:56 AM

Genre is one of the classes generated by Entity Framework. Can you verify that the GenreMenu control was typed to a Genre class? The markup should look like this (note the first line):

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<MvcMusicStore.Models.Genre>>" %>

<ul id="categories">
    <% foreach (var genre in Model) { %>
    <li>
        <%: Html.ActionLink(genre.Name, "Browse""Store"new { Genre = genre.Name }, null)%>
    </li>
    <% } %>
</ul>
Aug 25, 2010 at 5:29 PM

Thanks

 

I found GenreMenu was missing from StoreController. Now all working, I think, just needs tidying up.

 

Thanks for your help

 

Chris

Coordinator
Aug 31, 2010 at 6:29 PM

Great, glad you got it working.