开发者

Checkbox foreach item in the list

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜