我现在有定义为对象Tag
如下:返回列表<T>从视图到控制器在MVC 3
public class Tag
{
public string Name { get; set; }
}
现在,这是我定义为模型的集合属性:
public class MyModel
{
public string Name { get; set; }
public IList<Tag> Tags { get; set; }
}
在我看来,我有以下代码:
@using (Html.BeginForm())
{
<div>
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
</div>
<div>
<!--
Here I'd like a collection of checkbox inputs, where the selected names
get passed back to my controller via the IList<Tag> collection
-->
</div>
<input type="submit" value="Submit" />
}
如何通过我的模型的IList集合返回复选框组中的选定项目(在注释中指定)?
这是极好的!到底是什么,非常感谢! –