MVC 4: How do I line-wrap my text in an editor?

The solution is to add an annotation to the field in the model class:

[DataType(DataType.MultilineText)]

Then, to display the item in the view, use Html.Raw.

@Html.Raw("<pre>"+ Html.Encode(@Model.MyField) + "</pre>"

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

How can I call a JIRA api through Powershell?