InputBuilder's PartialView(“My”) doesn't work
-
02-10-2019 - |
문제
my viewmodel
public class CaseCreateInput
{
[PartialView("My")]
public object AreaId { get; set; }
}
My.aspx partialview
<%@ Page Title="" Language="C#" MasterPageFile="Field.Master"
Inherits="System.Web.Mvc.ViewPage<PropertyViewModel<object>>" %>
<%@ Import Namespace="MvcContrib.UI.InputBuilder.Views"%>
<asp:Content ID="Content1" ContentPlaceHolderID="Label" runat="server"><label for="<%=Model.Name%>"><%=Model.Label%></label></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Input" runat="server">
<%=Html.DropDownList(Model.Name,Model.Value as IEnumerable<SelectListItem>)%></asp:Content>
and when I do
Html.Input(o => o.AreaId)
it's actually looking for the Guid.aspx instead of looking for My.aspx from \views\shared
해결책 3
I switched to mvc 2 Templated Helpers, now it works
다른 팁
The problem seems to be coming from the fact that the AreaId property is of type object
. For example if you change it to string
it works fine.
I guess that the file My must be .ascx and not .aspx. It doesn't?
제휴하지 않습니다 StackOverflow