MVC FormCollection collection

<input type="checkbox"  name="rid" value="1">
<input type="checkbox"  name="rid" value="2">
<input type="checkbox"  name="rid" value="3">

Action上用FormCollection collection来获取被选中的checkbox:

当所有ckeckbox被选中时:

1、collection["rid"]的结果为:"1,2,3"

2、collection.GetValues("rid")结果为:string[] {1,2,3}

 

posted @ 2013-01-31 16:54  yuejin  阅读(3010)  评论(0编辑  收藏  举报