开发者

string <br/> to HTML

开发者 https://www.devze.com 2023-03-03 05:27 出处:网络
In my aSP.NET MVC model, I build a string, the result of this string is : \"MyName1 <br/> MyName2 <br/> MyName3\"

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开发者_如何学Go MyName2 MyName3

and not the stirng

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

How can I do this ?

Thanks,


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 %>
0

精彩评论

暂无评论...
验证码 换一张
取 消