【发布时间】:2019-08-25 13:29:28
【问题描述】:
在 index.cshtml 中我使用了一个锚标记助手
<a asp-action="Edit" asp-route-id="@Model.Id" asp-route-firstname="@Model.Name"</a>
在动作方法中
public IActionResult Edit(string id, string firstname)
{
// id and firstname are assigned correct values
// but RouteData.Values only has three entries which are: controller, action and id, where is firstname?
}
但是我不能通过RouteData.Values["firstname"]; 访问firstname 值,我可以通过RouteData.Values["id"]; 访问id 值,为什么它适用于id 而不适用于任何其他自定义属性?
【问题讨论】:
标签: c# asp.net-core-mvc tag-helpers