0

I am storing data entered from a rich text editor to database as an html string with font settings in MVC3 Razor. eg: Bold Red

In another page I have to displaying back this info along with the styles . I tried to display it as

<label id="lblDisplay" >@Html.Raw(@Model.IncidentDescription)</label> 

where @model.IncidentDescription have value <strong><span style="color:#ff0000">Bold Red</span></strong> . But it is only displaying "Bold Red" with out the style settings. How can I get my style settings displayed in a .cshtml page?

Anthon
  • 69,918
  • 32
  • 186
  • 246
Surya
  • 21
  • 4

1 Answers1

0

Please try the below:

<label id="lblDisplay">
 @Html.Raw(HttpUtility.HtmlDecode(@Model.IncidentDescription))</label>

Reference

Community
  • 1
  • 1
Amit
  • 15,217
  • 8
  • 46
  • 68