Trying to display two spaces between sentences in HTML error message

I know that browsers highlight extra spaces after one space. I usually use "  " to include a second space between sentences in my HTML.

In any case, I use ASP.NET MVC 3 and try to display an error message that is introduced to the page using the presentation model (as opposed to encoding directly into the HTML template). When I add "  " to the error line that I put in the view model, I get "  " on the resulting web page, I assume that MVC 3 HTML encodes the final rendering of the view.

Does anyone know a way around this so that I can regain my favorite double distance between sentences? :)

Thank!

+5
source share
1 answer

Use Html.Raw()in the view or change the view model from stringa HtmlString. In any case, get around the HTML encoding. As long as you are sure that it will be a "safe" line for rendering, everything should be fine.

+3
source

All Articles