Serhat Koroglu
Serhat Koroglu

Reputation: 1275

Decoding a text with percent symbol in Asp.net MVC Razor

There is a text on my web site html like;

%

that's about percentage you may know. I can't print it as percent symbol. I've tried Html helper's Raw method;

@Html.Raw(item.baslik)

but this produces just;

%

how can I achieve this?

Upvotes: 0

Views: 668

Answers (1)

Sedat Kapanoglu
Sedat Kapanoglu

Reputation: 47680

That means item.baslik is already HTML encoded. Try Html.Raw(HttpUtility.HtmlDecode(item.baslik)) instead. Or better, don't encode your property values prematurely, if you have access to the code.

Upvotes: 1

Related Questions