3

I am using Html.BeginForm but when trying to assign to it a class there is a problem. If i use class for the fourth place is fine. But if i try to use enctype in addition, there is a error. This is fine:

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

But this is not:

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

And this is not:

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

Any ideas please. Thank you

1 Answer 1

7

@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.

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

1 Comment

Thanks for the fast response, it does the job.

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.