I have action link with login button
@Html.ActionLink("Login", "Login", "Account")
It works perfect redirecting user to Account
controller Login
action.
But When I'm trying to add class to style this button:
@Html.ActionLink("Login", "Login", "Account", new { @class = "btn btn-primary btn-lg" })
It does get style and looks good, but it loses controller info and redirects user to Home/Login
, instead of Account/Login
You need to add a null parameter before your style, because it refers to routeValues
:
@Html.ActionLink("Login", "Login", "Account", null, new { @class = "btn btn-primary btn-lg" })
Have a look at it's documentation Here.