我将使用RouteValueDictionary来传递RouteValues到ActionLink:
如果我编写以下代码:
链接结果正常:
但如果我编写代码:
链接结果如下:
如果我编写以下代码:
<%:Html.ActionLink(SharedResources.Shared_Pagination_First, Model.ActionToExecute, Model.ControllerToExecute, Model.FirstRouteValues, null)%>
链接结果正常:
链接结果正常:
SearchArticles?refSearch=2&exact=False&manufacturerId=5&modelId=3485&engineId=-1&vehicleTypeId=5313&familyId=100032&page=0
但如果我编写代码:
<%: Html.ActionLink(SharedResources.Shared_Pagination_First, Model.ActionToExecute, Model.ControllerToExecute, Model.FirstRouteValues, new { @title = string.Format(SharedResources.Shared_Pagination_LinkTitle, 0) })%>
链接结果如下:
SearchArticles?Count=10&Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D
问题出在哪里?唯一的区别在于我在最后使用了htmlAttributes。