C#C
C#17mo ago
Cydo

✅ MVC application routing issue.

Why does the following code not work
                        <div>
                            <a asp-route-productId="@product.Id"
                               class="btn btn-primary bg-gradient border-0 form-control">
                                Details
                            </a>
                        </div>


But this code does

                        <div>
                            <a href="@Url.Action("Details", "Home", new { productId = product.Id })"
                               class="btn btn-primary bg-gradient border-0 form-control">
                                Details
                            </a>
                        </div>
Was this page helpful?