【发布时间】:2011-08-24 13:54:06
【问题描述】:
路线:
routes.MapRoute(
"Items", // Route name
"{controller}/{action}/{id}", // URL with parameters
new {controller = "Item", action = "Index", id = UrlParameter.Optional} // Parameter defaults
);
htmlhelper:
@Html.ActionLink("Chairs", "List", "Item", new {id="Chairs"}, null)
它生成的链接:
http://localhost:57899/Item/List?id=Chairs
我希望它显示的内容:
http://localhost:57899/Item/List/Chairs
怎么做?
【问题讨论】:
-
ItemController的List操作上的签名是什么? -
@David Signature?
public ActionResult List(string id) { return View(_repository.GetItems(id)); }
标签: asp.net-mvc-3 asp.net-mvc-routing html.actionlink