在Html.ActionLink()中使用/test#test
例如: 我有一个网页www.test.com/,如果我单击一个链接,例如在Html.ActionLink()中使用/test#test,html,asp.net-mvc,Html,Asp.net Mvc,例如: 我有一个网页www.test.com/,如果我单击一个链接,例如,那么该网页将跳转到ID为“test”的元素所在的位置。是否可以在Html.ActionLink()中实现相同的功能。显然,我可以保持相同的格式,但当使用#id在页面之间导航时,我也需要它来工作 因此,我正在寻找可以放置Html.ActionLink(“Text”、“Action”、“Controller”、“id”)的东西,您必须使用fragment参数: public static MvcHtmlString Actio
,那么该网页将跳转到ID为“test”的元素所在的位置。是否可以在Html.ActionLink()中实现相同的功能。显然,我可以保持相同的格式,但当使用#id在页面之间导航时,我也需要它来工作
因此,我正在寻找可以放置
Html.ActionLink(“Text”、“Action”、“Controller”、“id”)
的东西,您必须使用fragment参数:
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
string controllerName,
string protocol,
string hostName,
string fragment,
Object routeValues,
Object htmlAttributes
)
啊,谢谢,太棒了。我确实看了那里,但我不知道它被称为锚。