I'm using the following code to generate this:
<p>@Html.ActionLink("Read", "Index", "News", null, new { @class = "btn btn-default" })</p>
But I want to make a button that looks like this (with the use of HTML character »
):
However when I do the following:
<p>@Html.ActionLink("Read »", "Index", "News", null, new { @class = "btn btn-default" })</p>
I get this:
How do I fix this?
Other solutions given here work. But just in case you are wondering, what to do if you dont have the special character on keyboard, here it goes:
You can either use
<a href='@Url.Action("Index", "News")' class="btn btn-default">Read »</a>
OR
@Html.ActionLink(HttpUtility.HtmlDecode("Read »"), "Index", "News", null, new { @class = "btn btn-default" })
The text will be encoded by ActionLink() implementation, so you don't need to do it. Just use that char in the string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With