Delen via


DefaultHtmlGenerator.GenerateRouteLink Method

Definition

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

public:
 virtual Microsoft::AspNetCore::Mvc::Rendering::TagBuilder ^ GenerateRouteLink(Microsoft::AspNetCore::Mvc::Rendering::ViewContext ^ viewContext, System::String ^ linkText, System::String ^ routeName, System::String ^ protocol, System::String ^ hostName, System::String ^ fragment, System::Object ^ routeValues, System::Object ^ htmlAttributes);
public virtual Microsoft.AspNetCore.Mvc.Rendering.TagBuilder GenerateRouteLink (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, string linkText, string routeName, string protocol, string hostName, string fragment, object routeValues, object htmlAttributes);
abstract member GenerateRouteLink : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * string * string * string * string * string * obj * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
override this.GenerateRouteLink : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * string * string * string * string * string * obj * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
Public Overridable Function GenerateRouteLink (viewContext As ViewContext, linkText As String, routeName As String, protocol As String, hostName As String, fragment As String, routeValues As Object, htmlAttributes As Object) As TagBuilder

Parameters

viewContext
ViewContext

The ViewContext instance for the current scope.

linkText
String

The text to insert inside the element.

routeName
String

The name of the route to use for link generation.

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.

Implements

Applies to