Html.ActionLink ("LinkText", "ActionName") the first parameter of the overload is the text that the link is to display, the second parameter is the corresponding controller method, the default controller is the controller of the current page, if the controller for the current page is the products , then Html.ActionLink ("detail", "detail") generates <a href= "/products/detail" >all</a> two Html.ActionLink (" LinkText "," ActionName "," ControlName ") the overload has one more parameter than the first overload, and he specifies the name of the controller, such as Html.ActionLink (" detail "," detail "," products ") Will generate <a href= "Products/detail" >all</a> three Html.actionlik ("LinkText", "ActionName", routevalues) RouteValue can pass parameters to the action, such as Html.ActionLink ("detail", "detail", new {id=1}), which will generate <a href= "PRODUCTS/DETAIL/1" > Detail</a> This assumes that the current controller is products. Four html.actionlink ("LinkText", "ActionName", Routevalues,htmlattributes) Htmlattribute can set the properties of the <a> tag, such as Html.ActionLink ("detail", "detail", new{id=1},new{target= "_blank"}) will generate <a href = "PRODUCTS/DETAIL/1" target= "_blank" >DETAIL</A>, the main is if written new{target= "_blank", class= "ClassName"} will be an error, Because class is a keyword, it should be written here @class = "ClassName". Five Html.ActionLink ("LinkText", "ActionName", "ControlName", Routevalues,htmlattributes) The overload contains the above mentionedAll parameter types of
The
@html. Several parameter formats for ActionLink