我正在使用MVC 3,并有一个问题。而不是像我期望的那样给予mydomain/mydirectory/item我得到这个:MVC路由问题
mydomain/mydirectory/list?animal = quack。
这里是展示我是如何建立的联系在全球
//Default route mapping
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new { controller = @"[^\.]*", action = @"[^\.]*" }
);
代码路径:
<div id="main-content" title="AnimalBox" style="float:none;"> <% Html.DataList(Model.PriceListAnimals).Columns(7).Item(item => { item.Template(galleryImage => {%> <div style="margin-left:20px; line-height:150%;"> <span><%= Html.ActionLink(galleryImage.AnimalName,"List",new { @animal = galleryImage.AnimalName }) %></span> </div> <% }); }).Render(); %> </div>
任何想法?
分享您用来创建链接的代码也是一个好主意。 – Amry 2012-07-25 00:48:52