Haminteu
Haminteu

Reputation: 1334

Html to Formatted Text C#

I have a column on my table (SQL Server 2014).
Which contains, like <p><strong>Content</strong></p>

I want to display it on my Table View, currently I'm using MVC 5. Normally, I just need to add <td>@Html.DisplayFor(model => item.Content)</td>

It shows as is. I want to display it with formatted Html base on the content of my data.
Please help. Thank you.

Upvotes: 3

Views: 56

Answers (2)

Sam
Sam

Reputation: 394

I think what you're looking for is

@Html.Raw(Model.Content)

Upvotes: 3

Haminteu
Haminteu

Reputation: 1334

I just give up too early. I got the answer.

@Html.Raw(item.Content)

Thank you.

Upvotes: 1

Related Questions