i'm working on mvc.net..i want to create dyanmic view pages..it is possible?if yes then how?plz help
A:
We actually store NVelocity snippets in a database that we pull together at runtime and marry with ViewData objects to get an output HTML string that we just return via Content() instead of View().
It boils down to something like this (pseudo-code, not actual code):
var _viewDataObject = Products.All();
var _view = PageTemplate.Single(template=>template.Slug == PageTemplateEnums.HomePage);
var _outputHtml = nvelocityMemoryEngine.Transform(_view,_viewDataObject);
return Content(_outputHtml);
While we do some caching for performance reasons, this means you can change views without ever touching Visual Studio or deploying anything at the filesystem level.
It didn't take too much to add things like MimeType handling etc. and we can have people outside of the development team editing the views.
J Wynia
2010-04-29 01:11:13