开发者

InputBuilder's PartialView("My") doesn't work

开发者 https://www.devze.com 2023-01-06 19:08 出处:网络
my viewmodel public class CaseCreateInput { [PartialView(\"My\")] public object AreaId { get; set; } } My.aspx partialview

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<Pr开发者_如何学编程opertyViewModel<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


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?


I switched to mvc 2 Templated Helpers, now it works

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号