In my project, I have a parent and a child, and then the child as well has children so you can think about it as a three stages hierarchy. when I am in the third child (let me call it as a grandchild) I use an asp tag to go back to the second child view. the thing is what I am using right now gets me back to the whole index of the second child from all the parents, what I want is to get only the view of the second child of the parent I originally selected, not all children of all parents (Index). I hope this is not too complicated.
<a asp-controller="Surveys" asp-action="Index" class="btn btn-link">Back to Surveys</a>
i tried using asp-route-id="ViewData['ProjectId']" but still didn't work.
Try to pass project id using Model, something similar to this
HTML Output:
If you are pass id with separate name ( not default Id)
HTML Output:
Consider checking detailed article here
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/anchor-tag-helper?view=aspnetcore-5.0