IHtmlHelper.BeginForm(String, String, Object, FormMethod, Nullable<Boolean>, Object) IHtmlHelper.BeginForm(String, String, Object, FormMethod, Nullable<Boolean>, Object) IHtmlHelper.BeginForm(String, String, Object, FormMethod, Nullable<Boolean>, Object) Method

Definition

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

public Microsoft.AspNetCore.Mvc.Rendering.MvcForm BeginForm (string actionName, string controllerName, object routeValues, Microsoft.AspNetCore.Mvc.Rendering.FormMethod method, Nullable<bool> antiforgery, object htmlAttributes);
abstract member BeginForm : string * string * obj * Microsoft.AspNetCore.Mvc.Rendering.FormMethod * Nullable<bool> * obj -> Microsoft.AspNetCore.Mvc.Rendering.MvcForm
Public Function BeginForm (actionName As String, controllerName As String, routeValues As Object, method As FormMethod, antiforgery As Nullable(Of Boolean), htmlAttributes As Object) As MvcForm

Parameters

actionName
String String String

The name of the action method.

controllerName
String String String

The name of the controller.

routeValues
Object Object Object

An Object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the Object. This Object is typically created using Object initializer syntax. Alternatively, an IDictionary<TKey,TValue> instance containing the route parameters.

method
FormMethod FormMethod FormMethod

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

antiforgery
Nullable<Boolean>

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 Get.

htmlAttributes
Object Object Object

An Object that contains the HTML attributes for the element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

Returns

An MvcForm instance which renders the </form> end tag when disposed.

Remarks

In this context, "renders" means the method writes its output using Writer.

Applies to