1

I'm in the process of converting an Asp.Net MVC 5 project to an Asp Net Core MVC app and I'm pretty close to finishing but I'm noticing that the @Html.ActionLink helper did not port over correctly.

I have a view that uses @Html.ActionLink("Back to " + @action, @action, "SomeController", null, new { @class = "btn btn-primary" })

What is happening is that, even though I'm passing null as the routeValues parameter, it's keeping the parameter of the current page as the route value.

What am I doing wrong and what's the best way to resolve this?

2
  • Could you please include more codes to help reproduce ? Commented Feb 7, 2019 at 5:09
  • @NanYu what additional code are you looking for? The code in the view is pretty straight forward with the Html.ActionLink generating an html button. Commented Apr 24, 2019 at 3:41

1 Answer 1

1

For Asp.net core use the following markup

<a asp-controller="ControllerName" asp-action="ActionName" asp-route-id="" class="btn btn-success">Link</a>
Sign up to request clarification or add additional context in comments.

1 Comment

This created the exact same link the Html.ActionLink helper created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.