MVC: using BeginForm inside a custom HtmlHelper
I have the followin开发者_开发百科g code in a MVC view:
<% using (Html.BeginForm()) { %>
<input type="text" name="id"/>
...
...
<% } %>
I want to refactor it to be reused. So I want to move this code into a custom HtmlHelper.
How do I use the Html.BeginForm
in a helper?
Why not refactor it to a shared, partial view instead? Much easier than creating the helper method in code, in my opinion.
精彩评论