C
C#6mo ago
Gipper

ASP.NET How to create button to view under another controller?

What the title says. From a view under the Publicacoes controller I want to call another view under the Grupos controller. Currently I have this:
<a href="@Url.Action("Create", "GrupoController")">Criar grupo</a>
<a href="@Url.Action("Create", "GrupoController")">Criar grupo</a>
But it still says page can't be found. I have also tried:
<a href="@Url.Action("Create", "Grupo")">Criar grupo</a>
<a href="@Url.Action("Create", "Grupo")">Criar grupo</a>
Also, to no effect. Help?
5 Replies
Angius
Angius6mo ago
Try the asp- attributes asp-controller="Grupo" asp-action="Create"
Gipper
Gipper6mo ago
So, like this?
<a asp-controller"Grupo" asp-action="Create" href="/Grupo/Create">Criar grupo</a>
<a asp-controller"Grupo" asp-action="Create" href="/Grupo/Create">Criar grupo</a>
Angius
Angius6mo ago
Without the href
Gipper
Gipper6mo ago
still seems to give the same result nvm, I had mispelled the name of the controller it works fine now thanks again ❤️
jcotton42
jcotton426mo ago
to elaborate, the asp-* attributes create the href for you really that should generate some sort of warning, ideally
Want results from more Discord servers?
Add your server
More Posts