0
我有一個動態列表,我需要將選擇的項目從視圖返回給控制器。我檢查了鏈接CheckboxList in MVC3 View and get the checked items passed to the controller問題是我有一個動態列表,我需要所以我用MVC3動態列表更新問題
<table>
<tr>
@foreach (var item in mylist)
{
<td><img src='@item.PictureUrl'/><br />@Html.CheckBox(@item.Id,@item.checkedin)@item.Name</td>
}
</tr>
</table>
我也有同樣的形式,一個textarea來橫向顯示。
在控制器post方法中,我能夠訪問textarea值,但不能訪問列表或檢查項。請幫忙。
或者還有其他更好的方式來顯示我的列表並取回清單項目?
我是新來的MVC,任何幫助將不勝感激。
感謝
這可能會幫助你http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx – Rafay