我正在使用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