i have a form in which there can be multiple radio buttons generated dynamically in the view ,on the form submitted how can i collect the values in the controller. For example there are radio buttons dynamically generated like Gender (Male and Female), Education (BS,MS,BCS) . how can i have there value in the container.
Share
If you know the names of the radio buttons you could use action parameters. If the names are arbitrary you could fetch the values from a FormCollection parameter passed to your POST action (it is a
NameValueCollectionso you could loop through the key and get the corresponding values).Personally I would recommend you using deterministic names:
And in your controller action you could use a collection: