如何在“”之间使用剃刀模板
how to use razor template between " "
我正尝试在 link
中编写剃刀模板
<a asp-action="Details/@(customerModel.CustomerId)" class="button">Detail</a>
但在 html 中它呈现为这样
https://localhost:44316/User/Details%2F92e48182-6bc8-4c88-8de9-a7e0b5715f2b
ID 是 92e48182-6bc8-4c88-8de9-a7e0b5715f2b
为什么它不是这样呈现的?
https://localhost:44316/User/Details/92e48182-6bc8-4c88-8de9-a7e0b5715f2b
试试这个:
<a asp-action="Details" asp-controller="User" asp-route-id="@Model.CustomerId"
class="button"> Details </a>
我正尝试在 link
中编写剃刀模板 <a asp-action="Details/@(customerModel.CustomerId)" class="button">Detail</a>
但在 html 中它呈现为这样
https://localhost:44316/User/Details%2F92e48182-6bc8-4c88-8de9-a7e0b5715f2b
ID 是 92e48182-6bc8-4c88-8de9-a7e0b5715f2b
为什么它不是这样呈现的?
https://localhost:44316/User/Details/92e48182-6bc8-4c88-8de9-a7e0b5715f2b
试试这个:
<a asp-action="Details" asp-controller="User" asp-route-id="@Model.CustomerId"
class="button"> Details </a>