It appears you are calling the same render partial method twice, passing it once with the datatype CategoryDescription
and another time passing it a model with type IEnumerable<CategoryDescription>
. Have you tried commenting out the one that does not pass the correct data type for the view?
Try something like this:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<InnVue.Globe.Models.CategoryModel>" %>
<%@ Import Namespace="InnVue.Globe.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<%: ViewContext.RouteData.Values["Action"] %> Category
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: ViewContext.RouteData.Values["Action"] %> Category</h2>
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<fieldset>
<legend>CategoryDescription</legend>
<% foreach (var catdes in Model.CategoryDescriptions) { %>
<% Html.RenderPartial("CategoryDescriptions", catdes); %>
<% } %>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% } %>
<div>
<%: Html.ActionLink("Back to List", "Index") %>
</div>
</asp:Content>
And use this as your partial view:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<InnVue.Globe.Models.CategoryModel>" %>
<%: Html.EditorFor(m => m) %>
NickLarsen
2010-10-01 21:06:44