开发者

Checkbox foreach item in the list

开发者 https://www.devze.com 2023-03-06 08:53 出处:网络
I have a form to insert products into the database (by the moment I only put the product name): using (Html.BeginForm())

I have a form to insert products into the database (by the moment I only 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.Nam开发者_开发问答e, "Wrong name:please check"))
      </div>
       </fieldset>
    } 

What I would like now is how should I compose the form in order to show my database list of categories, showing a checkbox foreach category.

In my Product model I have a property List<Category> that I would like to complete with the chosen checkboxes from the user. But I don't know how to receive in my action the model with the property set.

How to solve this?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号