Reputation: 861
With the HTML tag <a>
onclick should I use
onclick="history.go(-1);"
or
href="@Url.Action("index", "somecontroller")"
What is the actual difference between these two methods as seen by a browser?
Upvotes: 0
Views: 1744
Reputation: 15923
You can either use:
Action Links : which creates <a href=".."></a>
tag automatically as
For example:
@Html.ActionLink("link text", "someaction", "somecontroller", new { id = "123" }, null)
generates:
<a href="/somecontroller/someaction/123">link text</a>
or
Url.Action as For example:
Url.Action("someaction", "somecontroller", new { id = "123" })
Upvotes: 2