如何从包括参数停止URL.Action? [英] How do I stop URL.Action from including parameters?
本文介绍了如何从包括参数停止URL.Action?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的主导航我有一个链接:
Url.Action(项目,常见问题解答);
链接工作正常,我得到〜/项目/ FAQ
不过,我有一个包含参数链接,这样:
〜/项目/问题/问题-1
这一切工作正常,但是,当我观看问题-1(这是一个视图,在主导航的变化链接:
〜/项目/问题/问题-1
我如何保持网址导航留在〜/项目/ FAQ
谢谢!
解决方案
Url.Action(项目,常见问题解答,新{WhateverYourRouteParameterIsCalled =})
In my main navigation I have a link to:
Url.Action("Items", "FAQ");
The link works fine and I get to ~/Item/FAQ
However, I have links which contain parameters, so:
~/Items/FAQ/Question-1
This all works fine, however, when I'm viewing Question-1 (which is a View, the link in the main navigation changes to:
~/Items/FAQ/Question-1
How do I keep the Url in the navigation to stay at ~/Items/FAQ
Thanks!
解决方案
Url.Action("Items", "FAQ", new { WhateverYourRouteParameterIsCalled = "" })
这篇关于如何从包括参数停止URL.Action?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文