0
我有以下看法:Html.EditorFor的模型,而不是一個性質,在MVC4
<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])
}
顯示可編輯的字段。定義此列表的哪些字段應該可編輯的最合適的方式是什麼?
感謝。在視圖中隱藏每一方的某些屬性,你認爲最好的方法是什麼?我可以在editorFor幫手中指定字段嗎? – RobVious 2013-02-11 14:37:08