Reputation: 101
I'd like to create a basic bootstrap button with a badge using Razor @Html.ActionLink syntax. I tried the following:
@Html.ActionLink(@Html.Raw("<span class=\"badge\">42</span>")+"System Message Here", "Index", "Message", null, new { @class = "btn btn-default" })
Which results in this. I would like to see the badge icon instead of the HTML. What is the correct syntax? Thanks in advance.
Upvotes: 2
Views: 2535
Reputation: 10499
You could just use Url.Action
instead, like so:
<a href="@Url.Action("Index", "Message")" class="btn btn-default">
<span class="badge">42</span> System Message Here
</a>
Upvotes: 3