<% using(Html.BeginForm()) { %>
...
<% } %>
或
<% Html.BeginForm(); %>
...
<% Html.EndForm(); %>
两种方式使用 Html.BeginForm 的优点/缺点是什么?
最佳答案
我更喜欢
<% using(Html.BeginForm()) { %>
...
<% } %>
只是为了确保在它未关闭时收到警告。但这并不是 using 语句的最大用途。
您可以找到更多信息 here .在渲染方面,不会有区别。
关于c# - 使用 HTML 帮助程序启动表单的首选方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3364333/