Reputation: 355
I am working with visual studio building a bookstore website for a class project and I am having trouble getting my strings to encode.
I basically print out the link to the details of a specific book
@Html.ActionLink(@Html.DisplayFor(modelItem => item.Title).ToString(), "Details", new { id = item.BookID })
With the title of the book (which is pulled straight from the database) contained as a parameter that is supposed to be displayed text.
@Html.DisplayFor(modelItem => item.Title).ToString()
But the issue is my output on the front end looks like this
How do I overcome this?
I have tried decoding to bytes then re-encoding, but to no avail.
Any help would be appreciated!
Thanks!
Upvotes: 0
Views: 298
Reputation: 186
What do you get when you do this?
@Html.ActionLink(item.Title, "Details", new { id = item.BookID })
Upvotes: 2
Reputation: 1838
Change the property of your Title to return a HtmlString since your titles appear to be already html encoded.
Upvotes: 0