Randy Hall
Randy Hall

Reputation: 8137

Display HTML from Entity Framework in the View

I have some html stored in a field I'm passing to my view, and as one would expect it is encoded by default in the scaffolded view:

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

So in my limited C# experience, I went to use the raw data:

@Html.Raw(model => model.Template)

Which throws an error:

Cannot convert lambda expression to type 'object' because it is not a delegate type

However none of the questions on that error seem to make sense with my situation, at least to my limited knowledge.

Upvotes: 0

Views: 244

Answers (1)

Okan Kocyigit
Okan Kocyigit

Reputation: 13421

HtmlHelper.Raw Method takes just one parameter which is string.

https://msdn.microsoft.com/en-us/library/gg480740(v=vs.118).aspx

@Html.Raw(Model.Template)

Upvotes: 2

Related Questions