I can't seem to figure out how to get a list of strings to render in my form as checkboxes. Tried a few things from various sites and questions/answers on here with no luck.
MODEL
var model = new ProjectModel()
{
ProjectType = new List<string>()
{
"Brand Creation",
"Web Design",
"Graphic Design",
"Custom Programming",
"E-Commerce",
"Other"
},
};
VIEW - I've tried the following ways.
@foreach (var item in Model.ProjectType)
{
@Html.CheckBoxFor(model => true, item)
<br />
}
@foreach (var item in Model.Budget)
{
@Html.CheckBox(item)
<br />
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…