Monday, March 26, 2018

Navigation/routing problem in asp.net MVC core 2

I'm currently learning asp.net core MVC 2.0 and I'm having trouble adding a "category" navigation to a "product" page. The categories show up fine, but nothing happens when I click on them. If I type localhost:60000/Soccer or /Soccer/Page1 it works fine. I've got no error message and I have no idea what is wrong. Any suggestion?

This is my Default.cshtml from Views/Shared/Components/NavigationMenu

@model IEnumerable<string> <a class="btn btn-block btn-light" asp-action="List" asp-controller="Product" asp-route-category=""> Home </a> @foreach (string category in Model) { <a class="btn btn-block @(category == ViewBag.SelectedCategory ? "btn-primary": "btn-light")" asp-action="List" asp-controller="Product" asp-route-category="@category" asp-route-productPage="1"> @category </a> } 

Is there any more code I should have posted?

Navigation/routing problem in asp.net MVC core 2 Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team