Search code examples
asp.netrazorasp.net-core-2.0

Razor Page - How to redirect to another folder's page using asp-for tag helper


I've been having issues with this but I think is simple.

asp.net core 2.0 Razor Pages

I have a Users/index page and I added a link to take me to the child records under Entries Folder.

Structure is like Pages /Users /Entries

Under /Pages/Users/index.cshtml

 <a asp-page="./Edit" asp-route-id="@item.Id">Edit</a> |
   <a asp-page="./Details" asp-route-id="@item.Id">Details</a>|
   <a asp-page="~/Pages/Entries/" asp-route-id="@item.Id">Enter Child Records</a>

However, on the browser, looks like is not rendering the correct link. It staying under the default page.

I tried asp-page="../Entries/" and other combinations with no luck.


Solution

  • Can't believe this but this works.

    <a asp-page="../Entries/Index" asp-route-id="@item.Id">test</a>