开发者

Parsing multiple checkbox values as a List

I'm making a web application using MVC3 with C#

I would like to get the checkboxes in my view defined as:

<input type="checkbox" name="group1[]" value="1" /> 
<input type="checkbox" name="group1[]" value="2" />
<input type="checkbox" name="group1[]" value="3" />

to be available as an List of values in the formCollection of a post method.

When I put a breakpoint it looks like the "group1" entry in the formCollection is indeed a list but I don't know how to get it using the 开发者_运维问答formCollection.Get method.


<input type="checkbox" name="group1[0]" value="1" /> 
<input type="checkbox" name="group1[1]" value="2" />
<input type="checkbox" name="group1[2]" value="3" />

Try using this

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜