ASP .NET MVC ActionLink



我试图在下面的代码中使(2)变成红色和粗体,但它只是显示标记。我尝试了Html.Raw(),但它返回了不能在ActionLink中使用的IHtmlString。

@{String surveyCount = "Survey <b>(2)<b>"; }
@Html.ActionLink(surveyCount, "Index", "Student")</a></li>
@{
 string surveyCount = 2;
 }
<a href="@Html.Action("Index","Student")">Survey <b>@surveyCount</b></a>

可以像这个一样

<a href="@Url.Action("Index", "Student")">Survey <span class="danger">(2)</span></a>

最新更新