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>"
[DataType(DataType.MultilineText)]
Then, to display the item in the view, use Html.Raw.
@Html.Raw("<pre>"+ Html.Encode(@Model.MyField) + "</pre>"
Comments
Post a Comment