Use anchor tag for calling an Action
You want an anchor, but the suggested code doesn't work. Try this way (it worked for me):
<a onclick="location.href='@Url.Action("ActionName")'">Something</a><br />
It will work this way, but you will not have the hand, when you hover the link. So just add href="#"
, like that:
<a href="#" onclick="location.href='@Url.Action("ActionName")'">Something</a><br />
Use @Html.ActionLink("Something", "ActionName", "ControllerName")
without the <a>
tag. It's generated automatically