編輯界面,我有一個模型: 菜單MenuComponent的@ HTML.editorForModel()不創建示範
的子類和菜單組件具有兩個屬性:名稱和說明都是字符串
我創建了一個編輯視圖並嘗試使用editorForModel()創建編輯字段。 但它不會爲其創建任何編輯字段。
@using (Html.BeginForm())
{
@Html.EditorForModel();
<input type="submit" value="Save" />
@Html.ActionLink("Cancel and return to List", "Index")
}
我必須使用@ HTML.EditorFor()創建編輯的Fileds
@using (Html.BeginForm())
{
@Html.EditorFor(m => m.Name);
@Html.EditorFor(m => m.Description);
<input type="submit" value="Save" />
@Html.ActionLink("Cancel and return to List", "Index")
}
爲什麼出現這種情況?
它們是什麼意思關於MEMBER OF INTERFACE? –
我想這是一個在您的模型實現的接口中定義的屬性。 –
爲什麼他們的意思是我的班級不能繼承這些屬性?因爲我可以在我的課堂上實施它們! –