【发布时间】:2008-11-25 10:07:09
【问题描述】:
我似乎无法检索我在控制器中的 html.ActionLink 中发送的 ID,这就是我正在尝试做的事情
<li>
<%= Html.ActionLink("Modify Villa", "Modify", "Villa", new { @id = "1" })%></li>
public ActionResult Modify(string ID)
{
ViewData["Title"] =ID;
return View();
}
这是我遵循的教程推荐的,但它不起作用,它还在 URL 的末尾加上 ?Length=5!
这是我正在使用的路线,它是默认的
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
【问题讨论】:
标签: c# asp.net-mvc