<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteControl.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Website.SimpleRepository.Page>>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
<h2>Page List</h2>
<p>
<%= Html.ActionLink("Create New", "Create") %>
</p>
<table>
<tr>
<th></th>
<th>
Display As
</th>
<th>
Layout
</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.DisplayAs) %>
</td>
<td>
<%= Html.Encode(item.Types.Name) %>
</td>
</tr>
<% } %>
</table>
</asp:Content>
I'm having difficult accessing the item.Types.Name it returns a null exception. I have my entity data model in a separate class library. Can anyone explain why its returning a null exception and what i can do to fix this? I have seen other projects that reference related table values but cannot work out why my work differs...
Any information on this subject would be great! Thanks.