Asp.net mvc 3 在运行时将Url.Action添加到RouteValueDictionary
我有一个名为Country的字符串属性,可通过所有viewmodels在视图中使用。 我想将此属性添加到Url.Action的RouteValueDictionary中,所以现在我必须更改每个 Url.Action to Url.Actionaction,控制器,新RouteValueDictionary{new {Country=Country} 我正在寻找干净的解决方案,在运行时将其添加到RouteValueDictionary 而不是更改Url。操作无处不在 请给我一些建议Asp.net mvc 3 在运行时将Url.Action添加到RouteValueDictionary,asp.net-mvc-3,razor,view,Asp.net Mvc 3,Razor,View,我有一个名为Country的字符串属性,可通过所有viewmodels在视图中使用。 我想将此属性添加到Url.Action的RouteValueDictionary中,所以现在我必须更改每个 Url.Action to Url.Actionaction,控制器,新RouteValueDictionary{new {Country=Country} 我正在寻找干净的解决方案,在运行时将其添加到RouteValueDictionary 而不是更改Url。操作无处不在 请给我一些建议 谢谢尝试一下,
谢谢尝试一下,就像只使用匿名对象一样:
Url.Action("action","controller", new {Country=Country} )
我希望不接触Url.Action,比如:Current Url.Actionaction,controller,new RouteValueDictionany{new{somevalues=somevalues}}而不修改它。