Search code examples
c#model-view-controllercheckboxradio-buttonformcollection

checkboxes and radio buttons in MVC FormCollection


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?


Solution

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