Manoz
Manoz

Reputation: 6597

Rendering HTML markup on client

I have saved markup in SQL Server via a rich text editor - http://hackerwins.github.io/summernote/

So in my case I just saved an header markup like: <h1>Header content</h1> and then tracking it back to view page like:

@Html.DisplayFor(model => model.businessDetails)

Model:

[AllowHtml]
public string businessDetails { get; set; }

This renders the view same as saved with markup in database.

<h1>Header content</h1>

How do I show formatted content without markup on client side?

Upvotes: 0

Views: 385

Answers (1)

nemesv
nemesv

Reputation: 139778

You need to use the Html.Raw method to turn off the automatic HTML encoding:

@Html.Raw(Model.businessDetails)

Upvotes: 4

Related Questions