How do you prefer to create your forms in MVC?

What format do you prefer to create your forms in MVC?

<% Html.Form() { %>
<% } %>

or

<form action="<%= Url.Action("ManageImage", "UserAccount") %>" method="post">
</form>

I understand that Html.Form () with PR5 now just uses the URL provided by the request. However, something about this does not suit me, especially since I will receive all the baggage of any requests included in it.

What do you do?

+4
source share
6 answers

The second way, of course. The first method is programmer-oriented, which is not part of the V-part of MVC. The second method is more focused on the designer, only attached to the model where necessary, leaving the HTML as natural as possible.

+7
source

, , , HTML-.

, NHaml, HTML .

+3

, WebForms, , , MVC. , , , , .

+1

HTML, , . . - , . , -, , , . , ASP.NET MVC.

+1

, . , , .Form(), , .

, V MVC. -, , , , . , . # , , -. , #, brail.

+1

, . , , .

For example, I blogged about some RESTful NHaml helpers that can create model-based URLs.

0
source

Source: https://habr.com/ru/post/1696659/


All Articles