HtmlHelperLinkExtensions Class¶
Summary¶
Link-related extensions for [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml).
Methods¶
-
ActionLink
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String)¶ Returns an anchor (<a>) element that contains a URL path to the specified action.
Arguments: - helper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- actionName (System.String) – The name of the action.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString ActionLink(IHtmlHelper helper, string linkText, string actionName)
-
ActionLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- 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 the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString ActionLink(IHtmlHelper helper, string linkText, string actionName, object routeValues)
-
ActionLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- 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 the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString ActionLink(IHtmlHelper helper, string linkText, string actionName, object routeValues, object htmlAttributes)
-
ActionLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- actionName (System.String) – The name of the action.
- controllerName (System.String) – The name of the controller.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString ActionLink(IHtmlHelper helper, string linkText, string actionName, string controllerName)
-
ActionLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- 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 the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString ActionLink(IHtmlHelper helper, string linkText, string actionName, string controllerName, object routeValues)
-
ActionLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- 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 the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString ActionLink(IHtmlHelper helper, string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes)
-
RouteLink
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object)¶ Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString RouteLink(IHtmlHelper htmlHelper, string linkText, object routeValues)
-
RouteLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- routeValues (System.Object) – An [System.Object]() that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString RouteLink(IHtmlHelper htmlHelper, string linkText, object routeValues, object htmlAttributes)
-
RouteLink
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String) Returns an anchor (<a>) element that contains a URL path to the specified route.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- routeName (System.String) – The name of the route.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString RouteLink(IHtmlHelper htmlHelper, string linkText, string routeName)
-
RouteLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- 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 the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString RouteLink(IHtmlHelper htmlHelper, string linkText, string routeName, object routeValues)
-
RouteLink
(Microsoft.AspNet.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.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- linkText (System.String) – The inner text of the anchor element. Must not be <c>null</c>.
- 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 the [System.Object](). This [System.Object]() is typically created using [System.Object]() initializer syntax. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the route parameters.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the anchor element.
public static HtmlString RouteLink(IHtmlHelper htmlHelper, string linkText, string routeName, object routeValues, object htmlAttributes)
-