Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何在 Asp.Net MVC 循环中呈现纯 HTML 链接?
我想创造这样的东西
<A href="#section2">Section Two</A>
使用 ASP.Net MVC 的 Html.Helper。怎么做?
您可以为此添加自己的助手:
public static class HtmlHelpers { public static string SectionLink(this HtmlHelper html, string URL, string display) { return String.Format("<a href=\"{0}\">{1}</a>", URL, display); } }
你像这样使用它:
@Html.SectionLink(section.Anchor, section.Name)