Do you have two forms per page with ASP.NET MVC?

Using web forms, I know that there can only be one ASP.NET form per page. I implemented some implementations in which I used Javascript to add other forms to the page to support elements such as input controls (which are sent back to Logon.aspx instead of the current page). I am wondering if one single form on the page is still present in ASP.NET MVC or if this restriction has been removed.

+3
source share
3 answers

You probably want to use regular HTML forms in your MVC code with an action attribute pointing to the corresponding controller action. This way you can have as many forms on the page as possible.

+6

ASP.NET MVC , . , ASP.NET Web Forms, (runat="server"), MVC , .

(i, e., runat='server' LiteralControl HtmlForm), .

- ( <%= code blocks %>), API- MVC (, <%= Html.Button() %>), - ASP.NET, , .

+1

You can have as many HTML forms as you see responsible .

0
source

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


All Articles