I need to use a static html page as an MVC3 razor masterpage.
It needs to be able to inject the controller’s razor-built view into a specified span tag on the static html page.
How do i go about:
- Load the static html
- Parse the static html string to the point where i need to inject the razor-view
- Inject the razor view.
Here’s the reason why– a client of ours wants to be able to publish static html (daily) from their CMS and have the application pick up on the “template” and use it for they dynamic sections of their site. They do not have any understanding of .NET and MVC3 and I can not have them interacting in any way with .NET and such.
Any ideas?
Thanks.
Assuming you only need to inject your view into one part of the HTML, you can chop the HTML into “before” and “after” pieces. Create a Layout.cshtml that has “before”, “middle”, and “after” sections. before & after are the parts you parsed from the .html, and middle is the result from your Razor view.