views:

171

answers:

2

Setup: ASP .NET MVC 1

The Problem:

When ASP .NET hits the RenderPartial("Openings"...) line, an exception is thrown ("Could not load type 'System.Web.Mvc.ViewUserControl(of IEnumerable(of OpenSpace))'.") even though the view exists and the proper model is being passed in. The views are all inside the View folder and in this case, they're even in the same subdirectory.

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>

The DateTimeAndArrangement view shows up correctly so I'm only posting the code for Openings:

<%@ 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%>

Note to myself: rev 134

A: 

Try this in the first line of your view (view declaration):

Inherits="System.Web.Mvc.ViewPage(of IEnumerable(of OpenSpace))"
eKek0
A: 

"Could not load type" suggests the ASP.NET compiler cannot find the assembly where OpenSpace is declared. A couple things to try:

  1. Fully qualify OpenSpace.

My guess is this is most likely the issue:

Inherits="System.Web.Mvc.ViewUserControl(of IEnumerable(of MyNamespace.OpenSpace))"
  1. Add the assembly to the compilation section of web.config.
Craig Stuntz