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.
给定 HTML 助手 ActionLink
@Html.ActionLink("About Us", "AboutUs", "Public", null, null)
如何访问 C# 类文件中的 actionLink 参数?
这可能吗?
ActionLinkLinkExtensions在命名空间中的类中定义System.Web.Mvc。它是HtmlHelper类的扩展方法。
ActionLink
LinkExtensions
System.Web.Mvc
HtmlHelper
为了从常规类调用该方法,您需要该类的一个实例HtmlHelper,但是您只需将其调用相同:
var link = htmlHelper.ActionLink("About Us", "AboutUs", "Public", null, null) var linkHtml = link.ToHtmlString();
请参阅 MSDN。