HtmlHelperFormExtensions Class

Summary

DisplayName-related extensions for [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml).

Syntax

public class HtmlHelperFormExtensions

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.Rendering.HtmlHelperFormExtensions

Methods

BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper)

Renders a &lt;form&gt; start tag to the response. The &lt;form&gt;’s <c>action</c> attribute value will match the current request.

Arguments:
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, Microsoft.AspNet.Mvc.Rendering.FormMethod)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the current action will process the request.

Arguments:
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, FormMethod method)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, Microsoft.AspNet.Mvc.Rendering.FormMethod, System.Object)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the current action will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • method (Microsoft.AspNet.Mvc.Rendering.FormMethod) – The HTTP method for processing the form, either GET or POST.
  • htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, FormMethod method, object htmlAttributes)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Object)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the current action will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, object routeValues)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the action with name

<paramref name=”actionName” /> will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • actionName (System.String) – The name of the action method.
  • controllerName (System.String) – The name of the controller.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, string actionName, string controllerName)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, Microsoft.AspNet.Mvc.Rendering.FormMethod)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the action with name

<paramref name=”actionName” /> will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • actionName (System.String) – The name of the action method.
  • controllerName (System.String) – The name of the controller.
  • method (Microsoft.AspNet.Mvc.Rendering.FormMethod) – The HTTP method for processing the form, either GET or POST.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, Microsoft.AspNet.Mvc.Rendering.FormMethod, System.Object)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the action with name

<paramref name=”actionName” /> will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • actionName (System.String) – The name of the action method.
  • controllerName (System.String) – The name of the controller.
  • method (Microsoft.AspNet.Mvc.Rendering.FormMethod) – The HTTP method for processing the form, either GET or POST.
  • htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, object htmlAttributes)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the action with name

<paramref name=”actionName” /> will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • actionName (System.String) – The name of the action method.
  • controllerName (System.String) – The name of the controller.
  • routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, string actionName, string controllerName, object routeValues)
BeginForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object, Microsoft.AspNet.Mvc.Rendering.FormMethod)

Renders a &lt;form&gt; start tag to the response. When the user submits the form, the action with name

<paramref name=”actionName” /> will process the request.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • actionName (System.String) – The name of the action method.
  • controllerName (System.String) – The name of the controller.
  • routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
  • method (Microsoft.AspNet.Mvc.Rendering.FormMethod) – The HTTP method for processing the form, either GET or POST.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginForm(IHtmlHelper htmlHelper, string actionName, string controllerName, object routeValues, FormMethod method)
BeginRouteForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Object)

Renders a &lt;form&gt; start tag to the response. The first route that can provide a URL with the specified <paramref name=”routeValues” /> generates the &lt;form&gt;’s <c>action</c> attribute value.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginRouteForm(IHtmlHelper htmlHelper, object routeValues)
BeginRouteForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String)

Renders a &lt;form&gt; start tag to the response. The route with name <paramref name=”routeName” /> generates the &lt;form&gt;’s <c>action</c> attribute value.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • routeName (System.String) – The name of the route.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginRouteForm(IHtmlHelper htmlHelper, string routeName)
BeginRouteForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, Microsoft.AspNet.Mvc.Rendering.FormMethod)

Renders a &lt;form&gt; start tag to the response. The route with name <paramref name=”routeName” /> generates the &lt;form&gt;’s <c>action</c> attribute value.

Arguments:
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginRouteForm(IHtmlHelper htmlHelper, string routeName, FormMethod method)
BeginRouteForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, Microsoft.AspNet.Mvc.Rendering.FormMethod, System.Object)

Renders a &lt;form&gt; start tag to the response. The route with name <paramref name=”routeName” /> generates the &lt;form&gt;’s <c>action</c> attribute value.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • routeName (System.String) – The name of the route.
  • method (Microsoft.AspNet.Mvc.Rendering.FormMethod) – The HTTP method for processing the form, either GET or POST.
  • htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginRouteForm(IHtmlHelper htmlHelper, string routeName, FormMethod method, object htmlAttributes)
BeginRouteForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object)

Renders a &lt;form&gt; start tag to the response. The route with name <paramref name=”routeName” /> generates the &lt;form&gt;’s <c>action</c> attribute value.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • routeName (System.String) – The name of the route.
  • routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginRouteForm(IHtmlHelper htmlHelper, string routeName, object routeValues)
BeginRouteForm(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object, Microsoft.AspNet.Mvc.Rendering.FormMethod)

Renders a &lt;form&gt; start tag to the response. The route with name <paramref name=”routeName” /> generates the &lt;form&gt;’s <c>action</c> attribute value.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • routeName (System.String) – The name of the route.
  • routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
  • method (Microsoft.AspNet.Mvc.Rendering.FormMethod) – The HTTP method for processing the form, either GET or POST.
Return type:

Microsoft.AspNet.Mvc.Rendering.MvcForm

Returns:

An [Microsoft.AspNet.Mvc.Rendering.MvcForm](Microsoft.AspNet.Mvc.Rendering.MvcForm.yml) instance which renders the &lt;/form&gt; end tag when disposed.

public static MvcForm BeginRouteForm(IHtmlHelper htmlHelper, string routeName, object routeValues, FormMethod method)