Edit Html.ActionLink output string
- by Aaron Salazar
I'm trying to output the following HTML using Html.ActionLink:
<a href="/About" class="read-more">Read More<span class="arrow">?</span></a>
I'm getting it done by doing an ActionLink, which outputs an tag and then manipulating the string.
<%= Html.ActionLink("[[replace]]", "Index", "About", null, new { @class = "read-more" }).ToHtmlString().Replace("[[replace]]", "Read More" + "<span class='arrow'>?</span>")%></p>
It'd be good if I could put HTML directly into the ActionLink but there doesn't seem to be a way based on my internet searches. Sure, it works but it seems like a hack. Is there a better way to accomplish this?