Export (0) Print
Expand All

HtmlHelper.GenerateRouteLink Method (RequestContext, RouteCollection, String, String, String, String, String, RouteValueDictionary, IDictionary(Of 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.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

'Declaration
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
'Usage
Dim requestContext As RequestContext 
Dim routeCollection As RouteCollection 
Dim linkText As String 
Dim routeName As String 
Dim protocol As String 
Dim hostName As String 
Dim fragment As String 
Dim routeValues As RouteValueDictionary 
Dim htmlAttributes As IDictionary(Of String, Object)
Dim returnValue As String 

returnValue = HtmlHelper.GenerateRouteLink(requestContext, _
	routeCollection, linkText, routeName, _
	protocol, hostName, fragment, routeValues, _
	htmlAttributes)

Parameters

requestContext
Type: System.Web.Routing.RequestContext

The context of the HTTP request.

routeCollection
Type: System.Web.Routing.RouteCollection

The collection of URL routes.

linkText
Type: System.String

The text caption to display for the link.

routeName
Type: System.String

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

protocol
Type: System.String

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

hostName
Type: System.String

The name of the host.

fragment
Type: System.String

The fragment identifier.

routeValues
Type: System.Web.Routing.RouteValueDictionary

An object that contains the parameters for a route.

htmlAttributes
Type: System.Collections.Generic.IDictionary(Of String, Object)

An object that contains the HTML attributes for the element.

Return Value

Type: System.String
An HTML element that links to the specified URL route.
Show:
© 2014 Microsoft