Html.EditorForModel doesnt render complex types

2020-06-23 04:55发布

I have a class with this property

        [Display(Name = "Estado Civil"),UIHint("EstadoCivil"),ScaffoldColumn(true)]
    public virtual EstadoCivil EstadoCivil { get; set; }

then in my view I call Html.EditForModel(), however the property doesnt show, I even have the template in my Controller's views folder and then "EditorTemplates", I'm using razor and my view is not strongly typed, would that have something to do?

1条回答
贼婆χ
2楼-- · 2020-06-23 05:45

By default editor/display templates descent only one level in the object hierarchy. Here's an excellent blog post from Brad Wilson which describes how you could have an editor template which descends more than 1 level.

查看更多
登录 后发表回答