@Html.ActionLink("Some link text", "MyAction", "MyController", protocol: null, hostName: null, fragment: "MyAnchor", routeValues: null, htmlAttributes: null)
当前输出:
<a href="/#MyAnchor"> Some Link Text</a>
我希望它是:
<a class="smoothScroll" href="/#MyAnchor">Some Link Text</a>
如果它们是在ASP.NET MVC +4 Razor中执行此操作的更好方法,请提供帮助。感谢
答案 0 :(得分:1)
将以下内容作为htmlAttributes参数传递:
new { @class = "smoothScroll" }