Search code examples
asp.net-mvctwitter-bootstraprazorrazorengine

Making a Bootstrap label clickable in a Razor View


I'm trying to make a Bootstrap Label clickable, using Razor syntax.

@Html.ActionLink("<span class=\"label label-danger\">" + @item.P1slared + "</span>", "queue", new { id = item.P1slared + "/" })

However it appears on my screen as below:

ScreenShot

Is there anyway I can make it output the actual label as a clickable link, similar to below:

Screen Shot as it should show

Thank you,

Mark


Solution

  • Why dont you Use @Url.Action Instead of Html.ActionLink. Like this

    <a href="@Url.Action("queue","ControllerName", new { id = item.P1slared })"><span class="label label-danger">@item.P1slared</span></a>