我有一个下拉视图,它与视图模型相关联......
视图模型的属性之一:
public int selectDTypeID { get; set; }
视图有一个下拉菜单:
Html.DropDownListFor(
model => model.selectDTypeID ,
new SelectList(
new List<Object>{
new { value = 1 , text = "Test1" },
new { value = 2 , text = "Test2" },
new { value = 3 , text = "Test3"}
},
"value",
"text"
)
)
如何在不使用额外参数的情况下获得回发下拉列表的值...我只想能够做到这一点...
[HttpPost]
public ActionResult ContinueDonation(AddDonationViewModel model)
{
var id = model.selectDTypeID;
}
我可以做这样的事情吗?