4

I have to say: This is a different question from these:

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 as html helper:


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

or as CustomViewResult


public RazorPartialViewResult CityHtml(City city)
{
   return new RazorPartialViewResult(city.FreeHtml,city)
}
Community
  • 1
  • 1
Serhat Dincel
  • 195
  • 1
  • 3
  • 12

1 Answers1

0

I think your answer is here: Storing ASP.Net MVC Views in the Database

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

Community
  • 1
  • 1
Tohid
  • 6,175
  • 7
  • 51
  • 80