Use anchor tag for calling an Action - MVC3
First I tried with
<input type="button" value="Something"
onclick="location.href='@Url.Action("ActionName")'" />
But this is a button and I want just a link. I've seen somewhere (while
wildly browsing the programming forums) a way to hide a button link behind
an anchor, but couldn't find/make it.
Then I tried with
<a href="@Html.ActionLink("Something", "ActionName", "ControllerName")"></a>
(here, actually, on the page, the link looked like Something">, whereas
the " and > shouldn't be there)
and also
<a href="@Url.Action("ActionName", "ControllerName")">Something</a>
but the latter 2 ways (with the anchor tag) don't work, by means, I don't
get directed to the other page. So, any suggestions about how to hide a
button behind a link, or how to make the anchor tags run ?
No comments:
Post a Comment