Edit Html.ActionLink output string

Posted by Aaron Salazar on Stack Overflow See other posts from Stack Overflow or by Aaron Salazar
Published on 2010-03-11T21:48:16Z Indexed on 2010/03/11 21:49 UTC
Read the original article Hit count: 395

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about html