with vistas vista parciales pagina net mvc formularios desarrollo crear con asp asp.net-mvc .net-3.5 partial-views strongly-typed-view

asp.net-mvc - vistas - partial view mvc 5 c#



ASP.NET MVC Vista parcial con una fuerte tipificación, indica que no se pudo cargar el error de tipo (1)

Estoy intentando crear una vista fuertemente tipada con un "Control de Usuario de Vista MVC" que se está procesando usando Html.RenderPartial (). La parte superior de mi archivo ascx se ve así:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.Collections.IEnumerable<string>>" %>

No hay nada más en esta página, actualmente.

Cuando ejecuto la aplicación y cargo la página que muestra este control, aparece el siguiente error:

Could not load type ''System.Web.Mvc.ViewUserControl<System.Collections.IEnumerable<string>>''.

Entonces, entonces lo simplifiqué:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<String>" %>

Y luego, por si fuera necesario estar completamente calificado:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.String>" %>

Cada vez me sale el mismo error (sustituyendo al tipo). ¿Qué estoy haciendo mal aquí? Estoy en .NET 3.5 con ASP.NET MVC 1.0 RTM.


Lo tengo funcionando. Seguí las instrucciones de http://www.codewrecks.com/blog/index.php/2009/04/05/could-not-load-type-systemwebmvcviewpage/ y eso me sirvió. Debo tener en cuenta que también actualicé a ASP.NET MVC 2.0 RC a partir del 3/17/2010 primero. El problema persistió para mí todavía hasta que seguí las instrucciones en esa página. No estoy seguro de si un nuevo proyecto MVC hace esto por ti ahora o no.

La solución, en caso de que desaparezca la página a la que se hace referencia, fue agregar un Web.config a mi directorio de Vistas y poner esto en él:

<?xml version="1.0"?> <configuration> <system.web> <httpHandlers> <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/> </httpHandlers> <!-- Enabling request validation in view pages would cause validation to occur after the input has already been processed by the controller. By default MVC performs request validation before a controller processes the input. To change this behavior apply the ValidateInputAttribute to a controller or action. --> <pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <controls> <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> </controls> </pages> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <handlers> <remove name="BlockViewHandler"/> <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/> </handlers> </system.webServer> </configuration>

También debo tener en cuenta que para MVC 2.0 necesita actualizar los números de versión en la configuración.