ActionLink 中的 html 实体

r m*_*r m 1 html-helper asp.net-mvc-views razor

如何在 ActionLink 中包含 html 实体。例如下面的情况»

<p>@Html.ActionLink("Link Text &raquo;", "Index", new { }, new { @class = "btn btn-warning", @role = "button" })</p>
Run Code Online (Sandbox Code Playgroud)

小智 5

使用 Url.Action 代替

<p><a href=@Url.Action("Index") role="button"><span class="btn btn-warning">Link Text &raquo;</span></a></p>
Run Code Online (Sandbox Code Playgroud)