HtmlHelper.GenerateRouteLink Method

Definition

Overloads

GenerateRouteLink(RequestContext, RouteCollection, String, String, RouteValueDictionary, IDictionary<String,Object>)

Generates an HTML anchor element (a element) that links to the specified URL route.

GenerateRouteLink(RequestContext, RouteCollection, String, String, String, String, String, RouteValueDictionary, IDictionary<String,Object>)

Generates an HTML anchor element (a element) that links to the specified URL route, and enables the user to specify the communication protocol, name of the host, and a URL fragment.

GenerateRouteLink(RequestContext, RouteCollection, String, String, RouteValueDictionary, IDictionary<String,Object>)

Generates an HTML anchor element (a element) that links to the specified URL route.

public static string GenerateRouteLink (System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteCollection routeCollection, string linkText, string routeName, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member GenerateRouteLink : System.Web.Routing.RequestContext * System.Web.Routing.RouteCollection * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> string
Public Shared Function GenerateRouteLink (requestContext As RequestContext, routeCollection As RouteCollection, linkText As String, routeName As String, routeValues As RouteValueDictionary, htmlAttributes As IDictionary(Of String, Object)) As String

Parameters

requestContext
RequestContext

The context of the HTTP request.

routeCollection
RouteCollection

The collection of URL routes.

linkText
String

The text caption to display for the link.

routeName
String

The name of the route that is used to return a virtual path.

routeValues
RouteValueDictionary

An object that contains the parameters for a route.

htmlAttributes
IDictionary<String,Object>

An object that contains the HTML attributes for the element.

Returns

String

An HTML element that links to the specified URL route.

Applies to

GenerateRouteLink(RequestContext, RouteCollection, String, String, String, String, String, RouteValueDictionary, IDictionary<String,Object>)

Generates an HTML anchor element (a element) that links to the specified URL route, and enables the user to specify the communication protocol, name of the host, and a URL fragment.

public static string GenerateRouteLink (System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteCollection routeCollection, string linkText, string routeName, string protocol, string hostName, string fragment, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member GenerateRouteLink : System.Web.Routing.RequestContext * System.Web.Routing.RouteCollection * string * string * string * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> string
Public Shared Function GenerateRouteLink (requestContext As RequestContext, routeCollection As RouteCollection, linkText As String, routeName As String, protocol As String, hostName As String, fragment As String, routeValues As RouteValueDictionary, htmlAttributes As IDictionary(Of String, Object)) As String

Parameters

requestContext
RequestContext

The context of the HTTP request.

routeCollection
RouteCollection

The collection of URL routes.

linkText
String

The text caption to display for the link.

routeName
String

The name of the route that is used to return a virtual path.

protocol
String

The communication protocol, such as HTTP or HTTPS. If this parameter is null, the protocol defaults to HTTP.

hostName
String

The name of the host.

fragment
String

The fragment identifier.

routeValues
RouteValueDictionary

An object that contains the parameters for a route.

htmlAttributes
IDictionary<String,Object>

An object that contains the HTML attributes for the element.

Returns

String

An HTML element that links to the specified URL route.

Applies to