Dela via


IHtmlHelper.BeginRouteForm Method

Definition

Renders a <form> start tag to the response. The route with name routeName generates the <form>'s action attribute value.

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

Parameters

routeName
String

The name of the route.

routeValues
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

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

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