Possible Duplicate:
Including an anchor tag in an asp.net mvc Html.ActionLink
代码:@Html.ActionLink("Link", "Action", "Controller", new { id = Id } )
目前我可以生成这样的链接:
我想生成这样的链接:
但我无法编辑路线/创建另一条路线。
最好的解决方案是什么?
最佳答案
只需使用 proper overload
ActionLink 帮助器的:
@Html.ActionLink(
linkText: "Link",
actionName: "Action",
controllerName: "Controller",
protocol: null,
hostName: null,
fragment: "divId",
routeValues: new { id = Id },
htmlAttributes: null
)
将生成:
<a href="/Controller/Action/123#divId">Link</a>
关于asp.net-mvc-3 - 如何在 ActionLink 中包含书签/片段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13835536/