If you have some formatted text, lets take the well known tongue twister “Around the ragged rock the ragged rascal ran” which in encoded form looks like this;
Around the <strong>ragged</strong> rock the <i>ragged</> rascal ran
Lets say you have passed the encoded text to your view via your view model.
You can display the formatted html directly in an MVC2 view like this:
<%= System.Web.HttpUtility.HtmlDecode(Model.yourEncodedHtml) %>
To display the fomatted html directly in an MVC3 view user the Raw Htmlhelper function like this:
@Html.Raw(System.Web.HttpUtility.HtmlDecode(Model.yourEncodedHtml))
@Html.Raw(Sever.HtmlDecode(Model.yourEncodedHtmlFromYourDatabase))
By directly I mean as the view content and not assigning the text to a Text or Value property of a control.