TheBoubou
TheBoubou

Reputation: 19933

string <br/> to HTML

In my aSP.NET MVC model, I build a string, the result of this string is :

"MyName1 <br/> MyName2 <br/> MyName3"

I'd like see in my HTML page the result like this : MyNAme1 MyName2 MyName3

and not the stirng

"MyName1 <br/> MyName2 <br/> MyName3"

How can I do this ?

Thanks,

Upvotes: 2

Views: 400

Answers (1)

Anders Fjeldstad
Anders Fjeldstad

Reputation: 10834

The key is outputting the string without HTML encoding. If you are using the Razor view engine:

@Html.Raw(Model.MyString)

And if you're using the WebForms view engine:

<%= Model.MyString %>

Upvotes: 7

Related Questions