C
C#11mo 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
Angius11mo ago
Try the asp- attributes asp-controller="Grupo" asp-action="Create"
Gipper
GipperOP11mo 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
Angius11mo ago
Without the href
Gipper
GipperOP11mo ago
still seems to give the same result nvm, I had mispelled the name of the controller it works fine now thanks again ❤️
jcotton42
jcotton4211mo 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