Search code examples
asp.net-mvcactionlinkhtml.actionlink

Using HTML tags inside linkText of Html.ActionLink


Is it possible to use HTML tags in the linkText of Html.ActionLink? For instance, if I wanted to bold part of the text of a link I would try something similar to this:

<%= Html.ActionLink("Some <b>bold</b> text", "Index")%>

but that just outputs

Some <b>bold</b> text

I know I could do this by using an anchor tag and setting the URL with Url.Action, but I just wanted to know if this was possible.


Solution

  • No; it's not possible.
    You need to manually write an <a> tag.