Asp.net mvc 5 中的路由问题
Routing Issue in Asp.net mvc 5
我在 Asp.net mvc 5 中工作。我在使用 Html.actionlink 时遇到问题。
@Html.ActionLink(cust.Name, "Details", "Customers", new { id = cust.Id },
null);
cust.name 是显示的文本,Details 是 Customers Controller 中的方法,我在 Details 方法中将 id 作为参数传递。
但问题是我已经通过调试检查了它,在单击 link(cust.name).
时控件不会转到 Details 方法
一直卡在这里,求帮助
@Html.ActionLink()
第一个参数是字符串,所以不能使用模型属性。我们可以使用 <a/>
标签而不是 @Html.ActionLink()
。
<a href="@Url.Action("Details","Customers",new{ id = cust.Id})">@cust.Name</a>
我在 Asp.net mvc 5 中工作。我在使用 Html.actionlink 时遇到问题。
@Html.ActionLink(cust.Name, "Details", "Customers", new { id = cust.Id },
null);
cust.name 是显示的文本,Details 是 Customers Controller 中的方法,我在 Details 方法中将 id 作为参数传递。 但问题是我已经通过调试检查了它,在单击 link(cust.name).
时控件不会转到 Details 方法一直卡在这里,求帮助
@Html.ActionLink()
第一个参数是字符串,所以不能使用模型属性。我们可以使用 <a/>
标签而不是 @Html.ActionLink()
。
<a href="@Url.Action("Details","Customers",new{ id = cust.Id})">@cust.Name</a>