[英]Html.RouteLink not producing correct link even with correct route name
我在_Layout.html中具有以下內容
@Html.RouteLink("test", "CityWithTypeSpecified", new { country = Model.CountryCode, state = Model.State, city = Model.CurrentCity.SubDomainName, description = type.Description, id = type.TypeID })
當繼承頁面由“ City”控制器提供服務時,鏈接會正常生成,當繼承頁面由另一個控制器提供服務時,鏈接網址為空白
這是我的路線
routes.MapRoute(
name: "CityWithTypeSpecified",
url: "{country}/{state}/{city}/{description}/{id}",
defaults: new { controller = "City", action = "LoadByType" }
);
我究竟做錯了什么?
解決了..我的某些項目為null ..如果您遇到相同的問題,請確保您的數據對於任何給定字段都不為null。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.