IHtmlHelper.ActionLink Method

Definition

Returns an anchor (<a>) element that contains a URL path to the specified action.

C#
public Microsoft.AspNetCore.Html.IHtmlContent ActionLink (string linkText, string actionName, string controllerName, string protocol, string hostname, string fragment, object routeValues, object htmlAttributes);

Parameters

linkText
String

The inner text of the anchor element. Must not be null.

actionName
String

The name of the action.

controllerName
String

The name of the controller.

protocol
String

The protocol for the URL, such as "http" or "https".

hostname
String

The host name for the URL.

fragment
String

The URL fragment name (the anchor name).

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 new IHtmlContent containing the anchor element.

Applies to

Product Versions
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