我的視圖模型如下:綁定一個簡單的整數數組到一個DropDownList在MVC3
public class ClassificationCalculatorIndexViewModel
{
public bool PlacementYear { get; set; }
public int[] Credit { get; set; } // List of Integers
public int selectedCredit { get; set; } // Somewhere to store selected integer
public List<YearOfStudy> StudyYear { get; set; }
}
我奮力的整型數組來一個DropDownList輔助對象綁定在我的Razor視圖,我做了以下內容:
@Html.DropDownListFor(Model.selectedCredit, Model.Credit)
但是,得到的錯誤,我想谷歌搜索,但一無所獲同一性質:(
什麼是錯誤您收到? – Dismissile
方法DropDownListFor <>的類型參數不能從使用推斷,請嘗試明確指定類型參數 – Ciwan