开发者

checkboxes and radio buttons in MVC FormCollection

开发者 https://www.devze.com 2023-04-04 05:28 出处:网络
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.

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 pleas开发者_开发百科e?


Been a while since I have looked at this but could it have something to do with check boxes only being submitted if they are checked.

As in if it is submitted its checked.

Iterate through the items in the form if the name of your check box appears its been submitted.


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

0

精彩评论

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

关注公众号