我在我的形式複選框
asp.net的MVC @ Html.CheckBoxFor
我在模型
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CorePartners_Site2.Models
{
public class CareerForm
{
//....
public List<CheckBoxes> EmploymentType { get; set; }
}
}
public class CheckBoxes
{
public string Text { get; set; }
public bool Checked { get; set; }
}
並在我的形式加入
@Html.CheckBoxFor(model => model.EmploymentType, new { id = "employmentType_1" })
@Html.CheckBoxFor(model => model.EmploymentType, new { id = "employmentType_2" })
@Html.CheckBoxFor(model => model.EmploymentType, new { id = "employmentType_3" })
,但我得到錯誤
有什麼不對?
我需要我的窗體中添加該代碼? – Heidel
@海德爾呀在你的表格 – mattytommo
我試過了,但是我得到了這個[http://i.imgur.com/Q78xcBD.png](http://i.imgur.com/Q78xcBD.png)。怎麼了? – Heidel