I want to use "NVelocity" from plain ASPX pages without using any MVC framework. I don't want to use "NVelocity View Engine" thru' asp.net MVC framework. The only example that I got for "NVelocity" is for merging and writing onto console window (http://www.castleproject.org/others/nvelocity/usingit.html)

I am looking out for example on to integrating "NVelocity" into aspx web forms. Any pointers would be really helpful.

有帮助吗?

解决方案

I found a way. The idea is the override Page.Render() method in an aspx page. Write the code in Render() method to transform the HTML template (I mean, *.html file or *.aspx file) using NVelocity. Pass HTMLTextWriter object while merging the template and context "template.Merge(context, writer);"

This will render the transformed HTML to web browser.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top