【发布时间】:2015-09-30 17:16:33
【问题描述】:
我正在尝试在辅助剃须刀功能中使用 BeginForm,例如。
@helper Modal(string name)
{
<div id="@name">
@using (Html.BeginForm("Add", "User", FormMethod.Post)) {
<fieldset>
@Html.Label("Name")
@Html.TextBox("Name", new { @class = "text ui-widget-content ui-corner-all" })
@Html.Label("Email")
@Html.TextBox("Email", new { @class = "text ui-widget-content ui-corner-all" })
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
</fieldset>
}
</div>
}
但是我得到一个错误:
@MyHelper.Modal("dialog-form")
这是由于 Html... 标记,没有它显然仅适用于 html。
我缺少什么让它工作?
我添加了@using System.Web.Mvc.Html;,但它仍然无法识别FormMethod。
【问题讨论】:
标签: asp.net-mvc razor html-helper html.beginform