LinkExtensions.ActionLink<TController> Method (HtmlHelper, Expression<Action<TController>>, String, Object)
Creates an anchor tag based on the passed in controller type and method.
Namespace: Microsoft.Web.Mvc
Assembly: Microsoft.Web.Mvc (in Microsoft.Web.Mvc.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function ActionLink(Of TController As Controller) ( _
helper As HtmlHelper, _
action As Expression(Of Action(Of TController)), _
linkText As String, _
htmlAttributes As Object _
) As MvcHtmlString
'Usage
Dim helper As HtmlHelper
Dim action As Expression(Of Action(Of TController))
Dim linkText As String
Dim htmlAttributes As Object
Dim returnValue As MvcHtmlString
returnValue = helper.ActionLink(action, _
linkText, htmlAttributes)
public static MvcHtmlString ActionLink<TController>(
this HtmlHelper helper,
Expression<Action<TController>> action,
string linkText,
Object htmlAttributes
)
where TController : Controller
[ExtensionAttribute]
public:
generic<typename TController>
where TController : Controller
static MvcHtmlString^ ActionLink(
HtmlHelper^ helper,
Expression<Action<TController>^>^ action,
String^ linkText,
Object^ htmlAttributes
)
static member ActionLink :
helper:HtmlHelper *
action:Expression<Action<'TController>> *
linkText:string *
htmlAttributes:Object -> MvcHtmlString when 'TController : Controller
JScript does not support generic types and methods.
Type Parameters
- TController
The Controller Type.
Parameters
- helper
Type: System.Web.Mvc.HtmlHelper
The HtmlHelper where to create the link.
- action
Type: System.Linq.Expressions.Expression<Action<TController>>
The Method to route to.
- linkText
Type: System.String
The linked text to appear on the page.
- htmlAttributes
Type: System.Object
Any additional HTML attributes.
Return Value
Type: System.Web.Mvc.MvcHtmlString
The anchor tag.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.118) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.118).