HtmlHelperLinkExtensions Class¶
Link-related extensions for Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
.
- Namespace
Microsoft.AspNetCore.Mvc.Rendering
- Assemblies
- Microsoft.AspNetCore.Mvc.ViewFeatures
Syntax¶
public class HtmlHelperLinkExtensions
-
class
Microsoft.AspNetCore.Mvc.Rendering.
HtmlHelperLinkExtensions
Methods¶
-
ActionLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String)¶ Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- actionName (System.String) – The name of the action.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent ActionLink(this IHtmlHelper helper, string linkText, string actionName)
- helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
ActionLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- actionName (System.String) – The name of the action.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent ActionLink(this IHtmlHelper helper, string linkText, string actionName, object routeValues)
- helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
ActionLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- actionName (System.String) – The name of the action.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters. - htmlAttributes (System.Object) – An
System.Object
that contains the HTML attributes for the element. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent ActionLink(this IHtmlHelper helper, string linkText, string actionName, object routeValues, object htmlAttributes)
- helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
ActionLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.String) Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- actionName (System.String) – The name of the action.
- controllerName (System.String) – The name of the controller.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent ActionLink(this IHtmlHelper helper, string linkText, string actionName, string controllerName)
- helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
ActionLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.String, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- actionName (System.String) – The name of the action.
- controllerName (System.String) – The name of the controller.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent ActionLink(this IHtmlHelper helper, string linkText, string actionName, string controllerName, object routeValues)
- helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
ActionLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.String, System.Object, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- actionName (System.String) – The name of the action.
- controllerName (System.String) – The name of the controller.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters. - htmlAttributes (System.Object) – An
System.Object
that contains the HTML attributes for the element. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent ActionLink(this IHtmlHelper helper, string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes)
- helper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
RouteLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Object)¶ Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent RouteLink(this IHtmlHelper htmlHelper, string linkText, object routeValues)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
RouteLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Object, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters. - htmlAttributes (System.Object) – An
System.Object
that contains the HTML attributes for the element. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent RouteLink(this IHtmlHelper htmlHelper, string linkText, object routeValues, object htmlAttributes)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
RouteLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String) Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- routeName (System.String) – The name of the route.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent RouteLink(this IHtmlHelper htmlHelper, string linkText, string routeName)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
RouteLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- routeName (System.String) – The name of the route.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent RouteLink(this IHtmlHelper htmlHelper, string linkText, string routeName, object routeValues)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
RouteLink
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object, System.Object) Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - linkText (System.String) – The inner text of the anchor element. Must not be <code>null</code>.
- routeName (System.String) – The name of the route.
- routeValues (System.Object) – An
System.Object
that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of theSystem.Object
. ThisSystem.Object
is typically created usingSystem.Object
initializer syntax. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the route parameters. - htmlAttributes (System.Object) – An
System.Object
that contains the HTML attributes for the element. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the anchor element.public static IHtmlContent RouteLink(this IHtmlHelper htmlHelper, string linkText, string routeName, object routeValues, object htmlAttributes)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-