我有课程:
public class PersonDetailsModel
{
public string FistName
{
get;
set;
}
public string LastName
{
get;
set;
}
public string Email
{
get;
set;
}
}
public class RegisterCoupleModel
{
public PersonDetailsModel Groom
{
get;
set;
}
public PersonDetailsModel Bride
{
get;
set;
}
public string UrlKeyword
{
get;
set;
}
public string ReCaptcha
{
get;
set;
}
}
文件夹 Shared > EditorTemplates
PersonDetailsModel.cshtml
@model BindSolution.AndMarried.ViewModel.PersonDetailsModel
<div class="editor-label">
@Html.LabelFor(m => m.FistName)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.FistName)
@Html.ValidationMessageFor(m => m.FistName)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.LastName)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.LastName)
@Html.ValidationMessageFor(m => m.LastName)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Email)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Email)
@Html.ValidationMessageFor(m => m.Email)
</div>
在我看来:
@Html.EditorForModel()
只显示UrlKeyword
和ReCapcha
字段!
为什么 Asp.net MVC 不使用共享文件夹中的模板来显示我的嵌套类型PersonDetailsModel
?