MVC html. actionlink, mvchtml. actionlink
Html. ActionLink
Description of ActionLink method parameters in the LinkExtensions class:
In simple words, this is the way you click.
Parameter type description
Text displayed for the link generated by linkText string
Method of the controller corresponding to actionName string
ControllerName string specifies the Controller name
Protocol string specifies the Access protocol
HostName string specifies the access domain name
Fragment string specifies the Access Point
RouteValues RouteValueDictionary parameter passed to the corresponding action
Or object
HtmlAttributes object or IDictionary setting <a> tag attributes
Reload 1:
@ Html. ActionLink ("LinkText","ActionName")
Example:
Effect:
Heavy Load 2:
@ Html. ActionLink ("LinkText","ActionName", RouteValues)
RouteValues is object:
Example:
Effect:
RouteValues isRouteValueDictionary:
Example:
Effect:
Heavy Load 3:
@ Html. ActionLink ("LinkText","ActionName",RouteValues, htmlAttributes)
HtmlAttributes is an object:
Example:
Effect:
HtmlAttributes is IDictionary:
Example:
Effect:
Reload 4:
@ Html. ActionLink ("LinkText","ActionName"," ControllerName ")
Example:
Effect:
Overload 5:
@ Html. ActionLink ("LinkText","ActionName","ControllerName"," RouteValues "," htmlAttributes ")
HtmlAttributes andRouteValuesObject:
Example:
Effect:
Note:If it is written as new {target = "_ blank", class = "className"}, an error is returned. Because the class is a keyword, it should be written as this → @ class = "className"
HtmlAttributes isIDictionaryAndRouteValues isRouteValueDictionary:
Example:
Effect:
Only partial Overloading is listed above. For more information, see LinkExtensions. cs under namespace System. Web. Mvc. Html.