我試圖爲List<Package>
創建Editortemplate。我完全限定的類型在我Editortemplate視圖,例如:Editortemplate的列表<ComplexType>沒有工作
@model List<JYP.Business.ViewModels.Package>
當我嘗試我Editortemplate視圖中的參考模型,我得到一個空引用這使我相信,該模型是沒有得到相關正常。我必須在我的ViewModel中使用UIHint
才能讓它使用Editortemplate。我的ViewModel包含一個List<Package> Packages
這正是我想讓我的自定義Editortemplate拿起。我究竟做錯了什麼?
無法您只需將它指定爲@model JYP.Business.ViewModels.Package因爲@ Html.EditorFor()將通過在模型中的軟件包列表會自動進行迭代,並調用您EditorTemplate爲他們每個人。 – 2011-12-25 00:34:29