2

我正在使用 Html.BeginForm 但是在尝试为其分配一个类时出现问题。如果我使用类作为第四名就可以了。但是,如果我尝试另外使用 enctype,则会出现错误。这可以:

@using (Html.BeginForm("Edit", "Inventory", FormMethod.Post, new {enctype = "multipart/form-data"}))

但这不是:

@using (Html.BeginForm("Edit", "Inventory", FormMethod.Post, new {enctype = "multipart/form-data"}, new { @class = "listForm" } ))

这不是:

@using (Html.BeginForm("Edit", "Inventory", FormMethod.Post, new { @class = "listForm" },  new {enctype = "multipart/form-data"}))

请有任何想法。谢谢

4

1 回答 1

6

@using (Html.BeginForm("Edit", "Inventory", FormMethod.Post, new { @class = "listForm", enctype ="multipart/form-data" }) Try that

EDIT:

enctype and class are both htmlAttributes so you should place them in one anonymous object.

于 2013-08-03T02:44:28.507 回答