0

I have a view with a form that's is typed to a viewmodel called AddEditItemVM. This viewmodel has the following property:

public List<Category> Categories{get;set;}

What im trying is two things:

  • Render a checkbox foreach Category in the generic category list of my viewmodel.

  • Make that when the form is posted receive, in my controller action, the property Categories instantiated (into the instance of AddEditItemVM)

About the first point, i would like to use any helper (if exists) that renders a group of checkboxes using lambda expressions like (m=>m.Categories), instead to render the checkbox with a foreach into the view.

About the second point, i read that there is one feature in MVC called Custom Model Binders. These get values from ValueProviders (querystring, cookies, or Form values) and creates the necessary instances passing it to specific action called after a form was posted. Should i create one custom model binder in order to receive my property Categories instantiated?

1 Answer 1

1

This might work

CheckboxList in MVC3.0

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.