Delen via


LinkExtensions.ActionLink Method

Definition

Overloads

ActionLink(HtmlHelper, String, String)

Returns an anchor element (a element) for the specified link text and action.

ActionLink(HtmlHelper, String, String, Object)

Returns an anchor element (a element) for the specified link text, action, and route values.

ActionLink(HtmlHelper, String, String, String)

Returns an anchor element (a element) for the specified link text, action, and controller.

ActionLink(HtmlHelper, String, String, RouteValueDictionary)

Returns an anchor element (a element) for the specified link text, action, and route values as a route value dictionary.

ActionLink(HtmlHelper, String, String, Object, Object)

Returns an anchor element (a element) for the specified link text, action, route values, and HTML attributes.

ActionLink(HtmlHelper, String, String, RouteValueDictionary, IDictionary<String,Object>)

Returns an anchor element (a element) for the specified link text, action, route values as a route value dictionary, and HTML attributes as a dictionary.

ActionLink(HtmlHelper, String, String, String, Object, Object)

Returns an anchor element (a element) for the specified link text, action, controller, route values, and HTML attributes.

ActionLink(HtmlHelper, String, String, String, RouteValueDictionary, IDictionary<String,Object>)

Returns an anchor element (a element) for the specified link text, action, controller, route values as a route value dictionary, and HTML attributes as a dictionary.

ActionLink(HtmlHelper, String, String, String, String, String, String, Object, Object)

Returns an anchor element (a element) for the specified link text, action, controller, protocol, host name, URL fragment, route values, and HTML attributes.

ActionLink(HtmlHelper, String, String, String, String, String, String, RouteValueDictionary, IDictionary<String,Object>)

Returns an anchor element (a element) for the specified link text, action, controller, protocol, host name, URL fragment, route values as a route value dictionary, and HTML attributes as a dictionary.

ActionLink(HtmlHelper, String, String)

Returns an anchor element (a element) for the specified link text and action.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, Object)

Returns an anchor element (a element) for the specified link text, action, and route values.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, object routeValues);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, routeValues As Object) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

routeValues
Object

An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, String)

Returns an anchor element (a element) for the specified link text, action, and controller.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, string controllerName);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, controllerName As String) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

controllerName
String

The name of the controller.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, RouteValueDictionary)

Returns an anchor element (a element) for the specified link text, action, and route values as a route value dictionary.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, System.Web.Routing.RouteValueDictionary routeValues);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * System.Web.Routing.RouteValueDictionary -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, routeValues As RouteValueDictionary) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

routeValues
RouteValueDictionary

An object that contains the parameters for a route.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, Object, Object)

Returns an anchor element (a element) for the specified link text, action, route values, and HTML attributes.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, object routeValues, object htmlAttributes);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * obj * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, routeValues As Object, htmlAttributes As Object) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

routeValues
Object

An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax.

htmlAttributes
Object

An object that contains the HTML attributes for the element. The attributes are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, RouteValueDictionary, IDictionary<String,Object>)

Returns an anchor element (a element) for the specified link text, action, route values as a route value dictionary, and HTML attributes as a dictionary.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, routeValues As RouteValueDictionary, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

routeValues
RouteValueDictionary

An object that contains the parameters for a route.

htmlAttributes
IDictionary<String,Object>

An object that contains the HTML attributes to set for the element.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, String, Object, Object)

Returns an anchor element (a element) for the specified link text, action, controller, route values, and HTML attributes.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * string * obj * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, controllerName As String, routeValues As Object, htmlAttributes As Object) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

controllerName
String

The name of the controller.

routeValues
Object

An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax.

htmlAttributes
Object

An object that contains the HTML attributes to set for the element.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, String, RouteValueDictionary, IDictionary<String,Object>)

Returns an anchor element (a element) for the specified link text, action, controller, route values as a route value dictionary, and HTML attributes as a dictionary.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, controllerName As String, routeValues As RouteValueDictionary, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

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 to set for the element.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, String, String, String, String, Object, Object)

Returns an anchor element (a element) for the specified link text, action, controller, protocol, host name, URL fragment, route values, and HTML attributes.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, string protocol, string hostName, string fragment, object routeValues, object htmlAttributes);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * string * string * string * string * obj * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText As String, actionName As String, controllerName As String, protocol As String, hostName As String, fragment As String, routeValues As Object, htmlAttributes As Object) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

controllerName
String

The name of the controller.

protocol
String

The protocol for the URL, such as "http" or "https".

hostName
String

The host name for the URL.

fragment
String

The URL fragment name (the anchor name).

routeValues
Object

An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. The object is typically created by using object initializer syntax.

htmlAttributes
Object

An object that contains the HTML attributes to set for the element.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to

ActionLink(HtmlHelper, String, String, String, String, String, String, RouteValueDictionary, IDictionary<String,Object>)

Returns an anchor element (a element) for the specified link text, action, controller, protocol, host name, URL fragment, route values as a route value dictionary, and HTML attributes as a dictionary.

public static System.Web.Mvc.MvcHtmlString ActionLink (this System.Web.Mvc.HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, string protocol, string hostName, string fragment, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ActionLink : System.Web.Mvc.HtmlHelper * string * string * string * string * string * string * System.Web.Routing.RouteValueDictionary * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ActionLink (htmlHelper As HtmlHelper, linkText 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 MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

linkText
String

The inner text of the anchor element.

actionName
String

The name of the action.

controllerName
String

The name of the controller.

protocol
String

The protocol for the URL, such as "http" or "https".

hostName
String

The host name for the URL.

fragment
String

The URL fragment name (the anchor name).

routeValues
RouteValueDictionary

An object that contains the parameters for a route.

htmlAttributes
IDictionary<String,Object>

An object that contains the HTML attributes to set for the element.

Returns

An anchor element (a element).

Exceptions

The linkText parameter is null or empty.

Applies to