設置:ASP .NET MVC 1呈現強類型的局部視圖
問題:
當ASP .NET打的RenderPartial( 「開放」 ...)行,則拋出異常(「莫非不是加載類型'System.Web.Mvc.ViewUserControl(IEnumerable(of OpenSpace)')。「),即使視圖存在並傳入適當的模型。視圖都在View文件夾內,在這種情況下,他們甚至在同一個子目錄中。
查看:
<%@ Page Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="CommonClasses" %>
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
Date, Time, and Furniture Arrangement
</asp:Content>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
<div id="floattext">
<h1>
Date, Time, and Furniture Arrangement</h1>
<div id="content">
<% Using Html.BeginForm%>
<div id="left">
<% Html.RenderPartial("DateTimeAndArrangement")%>
</div>
<div id="right">
<% Html.RenderPartial("Openings", New List(Of OpenSpace))%>
</div>
<% End Using%>
</div>
</div>
</asp:Content>
的DateTimeAndArrangement視圖顯示正確,所以我只張貼了開口代碼:對自己
<%@ Import Namespace="CommonClasses" %>
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(of IEnumerable(of OpenSpace))" %>
<% If Model.count = 0 Then%>
<p>
There are no open spots that match the event's requirements.</p>
<% Else%>
'Make a big clickable table with fancy AJAX magic
<% End If%>
注:反轉134