Missing Model Genre

Aug 24, 2010 at 11:34 PM

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



Aug 24, 2010 at 11:56 PM

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) { %>
        <%: Html.ActionLink(genre.Name, "Browse""Store"new { Genre = genre.Name }, null)%>
    <% } %>
Aug 25, 2010 at 4:29 PM



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


Thanks for your help



Aug 31, 2010 at 5:29 PM

Great, glad you got it working.