Reputation: 6057
I have read several topics (like this one: Database field containing HTML display raw text) but somehow can't find the solution.
I have this line:
@Html.DisplayFor(model => model.Content) // this works, but shows unparsed html
But this does not work:
@Html.Raw(model.Content)
I get an The name 'model' does not exist in the current context
error.
Since I used database first. I generated my model from the *.edmx
file. So Content
is of type String
.
thanks in advance!
ps. my first non-webform project.
Upvotes: 1
Views: 948
Reputation: 35793
You want to use Model
rather than model
:
@Html.Raw(Model.Content)
When using @Html.DisplayFor
the model is automatically passed in and given the name you assigned to it, in this case model.
Upvotes: 3