HtmlHelper.GenerateLink Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GenerateLink(RequestContext, RouteCollection, String, String, String, String, RouteValueDictionary, IDictionary<String,Object>) |
Generates an HTML anchor element (a element) that links to the specified action method. |
GenerateLink(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. |
GenerateLink(RequestContext, RouteCollection, String, String, String, String, RouteValueDictionary, IDictionary<String,Object>)
Generates an HTML anchor element (a element) that links to the specified action method.
public static string GenerateLink (System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteCollection routeCollection, string linkText, string routeName, string actionName, string controllerName, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member GenerateLink : System.Web.Routing.RequestContext * System.Web.Routing.RouteCollection * string * string * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> string
Public Shared Function GenerateLink (requestContext As RequestContext, routeCollection As RouteCollection, linkText As String, routeName As String, actionName As String, controllerName 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.
- actionName
- String
The name of the action method.
- controllerName
- String
The name of the controller.
- 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
An HTML element that links to the specified action method.
Applies to
GenerateLink(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.
public static string GenerateLink (System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteCollection routeCollection, string linkText, string routeName, string actionName, string controllerName, string protocol, string hostName, string fragment, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member GenerateLink : System.Web.Routing.RequestContext * System.Web.Routing.RouteCollection * string * string * string * string * string * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> string
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
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.
- actionName
- String
The name of the action method.
- controllerName
- String
The name of the controller.
- 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
An HTML element that links to the specified action method.