I'm trying to use BeginForm in a helper razor function eg.
@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>
}
However I am getting an error:
@MyHelper.Modal("dialog-form")
It's due to Html... markup, without it it obviously works fine with only html.
What am I missing to make it working?
I have added @using System.Web.Mvc.Html; but it still does not recognise FormMethod.