How can I get .cshtml from a database dynamically

I have to say: this is another question:

I want to provide dynamic .cshtml content from db when I want.

Example:

City table, FreeHtml column

  @model City 
 @ Html.CheckBox - @ Model.Name - @ Html.CustomHelper

How can I write an html helper:

@model City @Html.RazorRaw(Model.FreeHtml,Model) 

or as CustomViewResult

 public RazorPartialViewResult CityHtml(City city) { return new RazorPartialViewResult(city.FreeHtml,city) } 
+4
source share
1 answer

I think your answer is here: Storing ASP.Net MVC views in a database

You need to replace the default viewer with a custom one. Here is an example: http://weblogs.asp.net/imranbaloch/archive/2011/06/27/view-engine-with-dynamic-view-location.aspx

0
source

All Articles