我正在尝试创建一个链接 URL动作 ,结尾是 某物 我想路由值中有一些东西可以正确地完成这项工作,但是我在Google中找不到它。
到目前为止,我试过了 Url.Action("action", "controller", new {id="something", Area="area"}) . 结果链接是预期的/动作/控制器/区域,但我不能在结尾处附加一些内容。
Url.Action("action", "controller", new {id="something", Area="area"})
从网址上看,我可能会说 <a href="<%= Url.Action(..) %>#something"> 但这并没有让我觉得特别好,我正在寻找更好的解决方案。
<a href="<%= Url.Action(..) %>#something">
Url.Action()
public static MvcHtmlString Action(this UrlHelper urlHelper, string action, string controller, string hash) { return string.Format("{0}#{1}", urlHelper.Action(action, controller), hash); }
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx