Dynamic content in static content
I have got simple module in my开发者_如何学Go asp mvc page where can I generate some static html content from database.
For example
<% RenderAction("Article", "Article", new { articleId = 1 });%>
returns (PartialViewResult)
<ul>
<li><a href="someurl">Hello worlds</a></li>
</ul>
I would like to have possibility to use Url or even Html object in my static article for example (it could be also my custom object with limited functionality with generating links or rendering partial views)
<ul>
<li><a href="<%=Url.Action("Index", "Home")%>">Hello worlds</a></li>
</ul>
or even better
<div>
<p>my static content from database</p>
<% Html.RenderAction("SomeAction"); %> (It could be PartialViewResult)
</div>
What do you think about it?
You could write a custom virtual path provider or checkout Scripting ASP.NET MVC Views Stored In The Database.
精彩评论