开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜