I am trying to dynamically render pages from database. The view looks like this
@model MyModel
@{
ViewBag.Title = Model.Title;
Layout = Layout = "~/Views/Shared/_PageInnerLayout.cshtml";
}
@MvcHtmlString.Create(Model.Content)
MyModel has just 3 properties; Id, Title and Content
If the Content
has just HTML, the view renders just fine. But in some cases, I need to render partials too. So Content
may contain code like
@{
Html.RenderPartial("_FooterPartial");
}
This does not work. Its being rendered literally, like shown in the image below
How do I fix this so that the page is rendered properly?