HtmlHelper.GenerateLink Method (RequestContext, RouteCollection, String, String, String, String, String, String, String, RouteValueDictionary, IDictionary<String, Object>)

Generates an HTML anchor element (a element) that links to the specified action method, 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)

Syntax

'Declaration
Public Shared Function GenerateLink ( _
    requestContext As RequestContext, _
    routeCollection As RouteCollection, _
    linkText As String, _
    routeName As String, _
    actionName As String, _
    controllerName As String, _
    protocol As String, _
    hostName As String, _
    fragment As String, _
    routeValues As RouteValueDictionary, _
    htmlAttributes As IDictionary(Of String, Object) _
) As String
public static string GenerateLink(
    RequestContext requestContext,
    RouteCollection routeCollection,
    string linkText,
    string routeName,
    string actionName,
    string controllerName,
    string protocol,
    string hostName,
    string fragment,
    RouteValueDictionary routeValues,
    IDictionary<string, Object> htmlAttributes
)
public:
static String^ GenerateLink(
    RequestContext^ requestContext, 
    RouteCollection^ routeCollection, 
    String^ linkText, 
    String^ routeName, 
    String^ actionName, 
    String^ controllerName, 
    String^ protocol, 
    String^ hostName, 
    String^ fragment, 
    RouteValueDictionary^ routeValues, 
    IDictionary<String^, Object^>^ htmlAttributes
)

Parameters

  • 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 null reference (Nothing in Visual Basic), the protocol defaults to HTTP.

Return Value

Type: System.String
An HTML element that links to the specified action method.

See Also

Reference

HtmlHelper Class

GenerateLink Overload

System.Web.Mvc Namespace