我在將值綁定到下拉列表時遇到麻煩。模型public class DummyModel{ ... public int? OptionID { get; set; } ...}行內(nèi)視圖導致異常@Html.DropDownListFor(model => model.OptionID, new SelectList(ViewBag.AvailableOptions, "ID", "Name"))ViewBag的內(nèi)容?ViewBag.AvailableOptionsCount = 4 [0]: {[3, Average Speed]} [1]: {[4, Snails pace]} [2]: {[1, Super Fast]} [3]: {[2, Super Slow]}生成的異常:System.Web.HttpException:'DataBinding:'System.Collections.Generic.KeyValuePair`2 [[System.Int32,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089],[System.String,mscorlib,Version = 4.0.0.0,文化=中性,
@ Html.DropDownListFor的數(shù)據(jù)綁定異常
慕運維8079593
2021-05-07 17:15:27