1

I've a Control/View that render a HTML template Into the View with:

@(MvcHtmlString.Create(@Model.TemplateContent))

This works fine, but I would also like to make a Merge, I mean:

The Model.TemplateContent contains, for example, a model item like a:

Model.TemplateContent = "<p>The Name of the Customer is @Model.CustomerName</p>";
return View(model);

Is possible when View render Model.TemplateContent, render the model items into html template too?

amelian
  • 436
  • 1
  • 6
  • 17
  • 1
    you are somewhat mixing two concepts: rendering a view and outputting a string. –  Nov 19 '13 at 09:29
  • Yes this is true, but is that the customer need. I need a full result with a merge with Model and RawHTML, to generate a full View with all content. It's better that this will do before of Render? – amelian Nov 19 '13 at 10:00
  • possible duplicate of [ASP.NET MVC3 Razor - create view from a string?](http://stackoverflow.com/questions/4890046/asp-net-mvc3-razor-create-view-from-a-string) [take also a look to related questions] –  Nov 19 '13 at 10:23
  • 1
    check out http://razorengine.codeplex.com/ – Davor Zlotrg Nov 19 '13 at 10:43

1 Answers1

0
@Html.Raw(Model.TemplateContent)

@Html.Raw(string) returns markup that is not HTML encoded

Sai
  • 159
  • 1
  • 9