I have a form for inserting products into the database (by the time I just put the product name):
using (Html.BeginForm())
{
<fieldset>
<legend>Fields</legend>
<div>
@(Html.LabelFor(e => e.Name))
@(Html.TextBoxFor(e => e.Name))
@(Html.ValidationMessageFor(e => e.Name, "Wrong name:please check"))
</div>
</fieldset>
}
Now I would like for me to compile a form to show a list of categories in my database, indicating the category checkbox foreach.
In my product model, I have a property List<Category>that I would like to populate with selected checkboxes from the user. But I do not know how to get a model with a set of properties in its action.
Do you have examples on it or tips on how to solve this?
Thanks in advance.
Sincerely.
Jose.
source
share