复选框和单选按钮在MVC FormCollection [英] checkboxes and radio buttons in MVC FormCollection

查看:216
本文介绍了复选框和单选按钮在MVC FormCollection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一些搜索,以确定选择了哪个单选按钮,如果复选框被选中或不只是使用传递到我的Action方法的FormCollection。



原因我不会进入这里,我不能使用Html助手,所以自动添加隐藏的字段是为我。我确实发现有人建议使用GetValue()对集合对象来确定选择哪个单选按钮,但我似乎无法使它的工作,因为它正在寻找一个ValueProvider,我不知道放在哪里。



基本上我只是想确定点击哪个单选按钮,如果一个复选框被选中或没有与表单集合....为什么这样


b b p>我结束了序列化我的帖子数组,单选按钮和复选框刚刚工作。


I did some searching for determining which radio button is selected and if checkboxes are checked or not just using the FormCollection that is being passed to my Action method.

For reasons I won't go into here, I can't use Html helpers so the auto adding of hidden fields is out for me. I did find someone that suggested using GetValue() on the collection object to determine which radio button is selected, but I can't seem to make that work as it is looking for a ValueProvider and I"m not sure where to put that in.

Basically I just want to be able to determine which radio button is clicked and if a checkbox is checked or not with a form collection....why is that so hard?

Can anyone point me in the right directon please?

解决方案

I ended up serializing my post array and the radio buttons and checkboxes just worked.

这篇关于复选框和单选按钮在MVC FormCollection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆