I have the following code. Note that I am not using a using as I want to begin and end the form in two different areas of my code. Has anyone seen this action where the helper adds “System.Web.Mvc.Html.MvcForm”. I cannot see why this is added.
Code:
@Html.BeginForm(new { action = ViewContext.Controller.ValueProvider.GetValue("action").RawValue })
@{ Html.EndForm() }
Result:
<form action="/adminTests/Edit" method="post">System.Web.Mvc.Html.MvcForm
When I use the following I don’t get the “System.Web.Mvc.Html.MvcForm”
@using (Html.BeginForm(new { action = ViewContext.Controller.ValueProvider.GetValue("action").RawValue }))
{
}
The
BeginForm/EndFormhelpers don’t return aIHtmlResultso you should use them like this: