I used the TinyMCE editor to post content to the database so I've got html codes in the database. When I tried outputting it on my MVC View, the details page displayed perfectly with all the html formatting but the readmore page is outputting some html raw characters. Below is the code for the details view which outputs my html properly:
<h3>
@Html.Raw(Model.articleContent)
</h3>
And below is the code for the entire page where I have the read more.
<h3>
@{
var articleContent = @Html.Raw(item.articleContent);
ViewBag.articleContent = articleContent.ToString().Substring(0,300);
}
@ViewBag.articleContent
</h3>
The output I get for the above is like the below content:
Some test article title
<p>Team Aquamarine – Ola Ehimigbai, Murtala Saleh<br />PT,CSS ,SD Office, GRC,HRT and SP, this is quite a merger and Roland Guobadia, Lukman Longe and Cajetan and Igbokwe would hope that theirs, is a team that would finish up in the medal table, the light blue color of team aquamarine is the f
articleContent...item.articleContent,ViewBag.articleContentandModel.articleContentand the code shows a<h3>and the output a<p>