我有一個複選框,但形式提交打勾不被submited值...MVC複選框comeing回空
HTML:
@foreach (var radiobutton in Model.InterestedIn)
{
<span > @Html.CheckBox("selected", radiobutton)
<label>@radiobutton</label></span>
<br />
}
型號:
[Display(Name = "Would you be interested in receiving *")]
public IList<string> InterestedIn { get; set; }
控制器:
IList<string> lists = new List<string>();
lists.Insert(0, "Latest News");
lists.Insert(1, "Special Offers");
lists.Insert(1, "New Products");
model.InterestedIn = lists;
PostMethod:
[HttpPost]
public ActionResult Index(Competition model)
{
if (ModelState.IsValid)
{
控制器中的post方法是什麼樣的?它的簽名是什麼?你如何試圖訪問複選框的值? – 2012-03-02 15:35:35