IHtmlGenerator.GenerateActionLink Method

Definition

Generate a <a> element for a link to an action.

C#
public Microsoft.AspNetCore.Mvc.Rendering.TagBuilder GenerateActionLink (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, string linkText, string actionName, string controllerName, string protocol, string hostname, string fragment, object routeValues, object htmlAttributes);

Parameters

viewContext
ViewContext

The ViewContext instance for the current scope.

linkText
String

The text to insert inside the element.

actionName
String

The name of the action method.

controllerName
String

The name of the controller.

protocol
String

The protocol (scheme) for the generated link.

hostname
String

The hostname for the generated link.

fragment
String

The fragment for the generated link.

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.

htmlAttributes
Object

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

Returns

A TagBuilder instance for the <a> element.

Applies to

منتج الإصدارات
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0