I am fairly new to .net. I using strongly typed viewmodels. I have a general question: is it possible to add checkboxes (or buttons) to the view without adding them to the viewmodel and access the value (checked or unchecked) in the controller action? If so, please explain how. Does the method have to be post? Thanks
You can always get your form data by using:
Or add them as arguments to the postback Action method:
But why not add them to your model, this will make it a lot easier if want the use to correct validation error.
I don't really understand what you mean by adding checkboxes to the view without adding them to the viewmodel but let me try to illustrate with some example:
Suppose that you have the following form:
and a controller which would receive the form POST: