我有以下看法:
<fieldset>
<legend>CreateCardViewModel</legend>
<div class="editor-field">
@Html.EditorFor(model => model.SetId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.DateCreated)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.DateCreated)
@Html.ValidationMessageFor(model => model.DateCreated)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.IsReady)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.IsReady)
@Html.ValidationMessageFor(model => model.IsReady)
</div>
@foreach (var side in Model.Sides)
{
@Html.EditorFor(model => model.Sides[side.SideId])
}
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
这个片段:
@foreach (var side in Model.Sides)
{
@Html.EditorFor(model => model.Sides[side.SideId])
}
显示 Sides 模型的所有属性的可编辑字段。定义该列表的哪些字段应该是可编辑的最合适的方法是什么?