Html.ActionLink
In the Linkextensions class, the ActionLink method parameter description:
In a nutshell, it's like this.
Parameter type description
LinkText the text displayed by the link generated by the string
ActionName string corresponding to the Controller method
Controllername string Specifies the name of the controller
Protocol string specifies the Access protocol
HostName string specifies access to the domain name
Fragment string specifies access to the anchor point
Routevalues routevaluedictionary The arguments passed to the corresponding action
or object
Htmlattributes object or IDictionary properties of settings <a> tags
Overload one:
@Html. ActionLink ("linkText", "actionname")
Cases:
Build Effect:
Overload two:
@Html. ActionLink ("linkText", "actionname", routevalues)
Routevalues is an object:
Cases:
Build Effect:
Routevalues is routevaluedictionary:
Cases:
Build Effect:
Overload three:
@Html. ActionLink ("linkText", "actionname", routevalues,htmlattributes)
Htmlattributes is an object:
Cases:
Build Effect:
Htmlattributes is IDictionary:
Cases:
Build Effect:
Overload four:
@Html. ActionLink ("linkText", "actionname", "Controllername")
Cases:
Build Effect:
Overload five:
@Html. ActionLink ("linkText", "actionname", "controllername", "routevalues", " Htmlattributes ")
Both Htmlattributes and routevalues are object:
Example:
Build Effect:
Note: if written new{target= "_blank", class= "ClassName"} will error, because class is the keyword, so should be written like this → @class = "className"
Htmlattributes is IDictionary and routevalues is routevaluedictionary:
Example:
Build Effect:
There are only a few overloads listed above, and you want to know more about this class under the namespace namespace System.Web.Mvc.Html LinkExtensions.cs
MVC Html.ActionLink