Share via


HtmlHelper.RouteLink Method

Definition

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

public:
 virtual Microsoft::AspNetCore::Html::IHtmlContent ^ RouteLink(System::String ^ linkText, System::String ^ routeName, System::String ^ protocol, System::String ^ hostName, System::String ^ fragment, System::Object ^ routeValues, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Html.IHtmlContent RouteLink (string linkText, string routeName, string protocol, string hostName, string fragment, object routeValues, object htmlAttributes);
abstract member RouteLink : string * string * string * string * string * obj * obj -> Microsoft.AspNetCore.Html.IHtmlContent
override this.RouteLink : string * string * string * string * string * obj * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function RouteLink (linkText As String, routeName As String, protocol As String, hostName As String, fragment As String, routeValues As Object, htmlAttributes As Object) As IHtmlContent

Parameters

linkText
String

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

routeName
String

The name of the route.

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.

Implements

Applies to