Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class HtmlHelperFormExtensions

Extension methods for Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper to render <form> elements for content routed items

Inheritance
System.Object
HtmlHelperFormExtensions
Namespace: EPiServer.Web.Mvc.Html
Assembly: EPiServer.Cms.AspNetCore.HtmlHelpers.dll
Version: 12.0.3
Syntax
public static class HtmlHelperFormExtensions : Object

Methods

BeginContentForm(IHtmlHelper)

Renders a <form> start tag to the response. The <form>'s action attribute value will match the current request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, ContentReference, String, VirtualPathArguments, Nullable<FormMethod>, Nullable<Boolean>, Object)

Renders a <form> start tag to the response. When the user submits the form, the action with name Action will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, ContentReference contentLink, string language, VirtualPathArguments virtualPathArguments, Nullable<FormMethod> method, Nullable<bool> antiforgery, object htmlAttributes)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

ContentReference contentLink

The content link which the form relates to

System.String language

The language for the content.

VirtualPathArguments virtualPathArguments

Virtual path arguments to control the url generation

System.Nullable<Microsoft.AspNetCore.Mvc.Rendering.FormMethod> method

The HTTP method for processing the form, either GET or POST.

System.Nullable<System.Boolean> antiforgery

If true, <form> elements will include an antiforgery token. If false, suppresses the generation an <input> of type "hidden" with an antiforgery token. If null, <form> elements will include an antiforgery token only if method is not Microsoft.AspNetCore.Mvc.Rendering.FormMethod.Get.

System.Object htmlAttributes

An System.Object that contains the HTML attributes for the element. Alternatively, an System.Collections.Generic.IDictionary<, > instance containing the HTML attributes.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

BeginContentForm(IHtmlHelper, FormMethod)

Renders a <form> start tag to the response. When the user submits the form, the current action will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, FormMethod method)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

Microsoft.AspNetCore.Mvc.Rendering.FormMethod method

The HTTP method for processing the form, either GET or POST.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, FormMethod, Nullable<Boolean>, Object)

Renders a <form> start tag to the response. When the user submits the form, the current action will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, FormMethod method, Nullable<bool> antiforgery, object htmlAttributes)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

Microsoft.AspNetCore.Mvc.Rendering.FormMethod method

The HTTP method for processing the form, either GET or POST.

System.Nullable<System.Boolean> antiforgery

If true, <form> elements will include an antiforgery token. If false, suppresses the generation an <input> of type "hidden" with an antiforgery token. If null, <form> elements will include an antiforgery token only if method is not Microsoft.AspNetCore.Mvc.Rendering.FormMethod.Get.

System.Object htmlAttributes

An System.Object that contains the HTML attributes for the element. Alternatively, an System.Collections.Generic.IDictionary<, > instance containing the HTML attributes.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, FormMethod, Object)

Renders a <form> start tag to the response. When the user submits the form, the current action will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, FormMethod method, object htmlAttributes)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

Microsoft.AspNetCore.Mvc.Rendering.FormMethod method

The HTTP method for processing the form, either GET or POST.

System.Object htmlAttributes

An System.Object that contains the HTML attributes for the element. Alternatively, an System.Collections.Generic.IDictionary<, > instance containing the HTML attributes.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, Nullable<Boolean>)

Renders a <form> start tag to the response. The <form>'s action attribute value will match the current request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, Nullable<bool> antiforgery)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

System.Nullable<System.Boolean> antiforgery

If true, <form> elements will include an antiforgery token. If false, suppresses the generation an <input> of type "hidden" with an antiforgery token. If null, <form> elements will include an antiforgery token.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, Object)

Renders a <form> start tag to the response. When the user submits the form, the current action will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, object routeValues)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

System.Object routeValues

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<, > instance containing the route parameters.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, String)

Renders a <form> start tag to the response. When the user submits the form, the action with name actionName will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, string actionName)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

System.String actionName

The name of the action method.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, String, ContentReference)

Renders a <form> start tag to the response. When the user submits the form, the action with name actionName will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, string actionName, ContentReference contentLink)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

System.String actionName

The name of the action method.

ContentReference contentLink

The content link which the form relates to

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, String, ContentReference, String)

Renders a <form> start tag to the response. When the user submits the form, the action with name actionName will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, string actionName, ContentReference contentLink, string language)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

System.String actionName

The name of the action method.

ContentReference contentLink

The content link which the form relates to

System.String language

The language for the content.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.

BeginContentForm(IHtmlHelper, String, ContentReference, String, Object)

Renders a <form> start tag to the response. When the user submits the form, the action with name actionName will process the request.

Declaration
public static MvcForm BeginContentForm(this IHtmlHelper htmlHelper, string actionName, ContentReference contentLink, string language, object htmlAttributes)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper

The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.

System.String actionName

The name of the action method.

ContentReference contentLink

The content link which the form relates to

System.String language

The language for the content.

System.Object htmlAttributes

An System.Object that contains the HTML attributes for the element. Alternatively, an System.Collections.Generic.IDictionary<, > instance containing the HTML attributes.

Returns
Type Description
Microsoft.AspNetCore.Mvc.Rendering.MvcForm

An Microsoft.AspNetCore.Mvc.Rendering.MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Microsoft.AspNetCore.Mvc.Rendering.ViewContext.Writer.