0

このようなURLに追加するにはどうすればよいですか

mysite.com/articles/1/my-first-article

dividが#commentListの要素

mysite.com/articles/1/my-first-article#commentList


<%: Html.ActionLink("text", "action", new {/* ??? HOW TO SET IT HERE ??? */})%>
4

1 に答える 1

2

適切なオーバーロード(フラグメントを取得するもの)を使用してみてください。これにより、フラグメント部分を含む目的のURLを生成できます。

<%= Html.ActionLink(
    "some text",     // linkText
    "articles",      // actionName
    null,            // controllerName
    null,            // protocol
    null,            // hostName
    "commentList",   // fragment <-- that's what you need
    new { id = 1 },  // routeValues
    null             // htmlAttributes
) %>
于 2011-06-19T22:04:57.847 に答える