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}

原文地址:https://www.cnblogs.com/yuejin/p/2887341.html