Reputation: 9080
I'm trying to decode the strings from the database, but when I try to use this code in an ActionLink the encoded values still display.
var questionText = @Html.DisplayFor(modelItem => item.QuestionText);
var decodedText = @Html.Raw(HttpUtility.HtmlDecode(questionText.ToString()));
@if (User.Identity.IsAuthenticated)
{
<h4>@Html.ActionLink(decodedText.ToHtmlString(), "Edit", new { id = item.QuestionId })</h4>
}
What needs to be done for the text to display correctly in the ActionLink?
Upvotes: 0
Views: 164
Reputation: 887453
IHtmlString
(which Html.Raw()
returns) is only recognized by raw @
expresisons; not by other helper methods.
You need to write an <a>
tag yourself.
Upvotes: 1