# Simplifying ASP.Net - NVelocity

<http://simpable.com/code/nvelocity/>

- Host: [simpable.com](https://links.thingelstad.xyz/hosts/simpable.com/)
- Saved: May 12, 2008 (2008-05-12T20:53:08Z)
- Record: https://links.thingelstad.xyz/links/2caf72cbae3d/
- JSON: https://links.thingelstad.xyz/links/2caf72cbae3d.json

## From the page (probably an excerpt, not Jamie's words)

NVelocity[1] is a .NET port of the Velocity open source template engine. I have used NVelocity quite a few times over the last couple of years.
  CSBTL - this project never went public, but basically it removed the need to understand web forums and complicated server controls for building Community Server blog themes.  Graffiti - Graffiti supports a very simple theming model which enables building new themes with no knowledge of web forms and/or ASP.Net While you have more options using aspx pages, I generally prefer the simplicity of doing web pages via NVelocity. There are no complicated server controls, complete control over the markup, simple extensibility, and no need to jump between contexts when iterating over a list. 
 With this in mind, I was very happy to find the NVelocityViewFactory as part of the MvcContrib project. With just a couple configuration steps, I was able to use NVelocity views for my ASP.Net MVC projects. Sweetness! 
 For example, Phil Haack, has a post which discusses options to doing a simple repeater. This could be greatly simplified with NVelocity (see below). No code needs to be written, no context switching for properties, etc.
  <table>#foreach($hobby in $hobbies)  <tr class="#if($velocityCount % 2 == 0)row #else alt-row #end">    <td>$hobby.Title</td>  </tr>#end</table>
In addition, using fancy loops we could easily add content to be shown if it is empty and better structure our markup.


#foreach($hobby in $hobbies)#beforeall    <table>#before    <tr class=#even    "row">#odd     "alt-row">#each    <td>$hobby.Title</td> #after    </tr>#afterall    </table>#nodata    <h3>Sorry, no hobbies</h3>#end
The above example takes it to the extreme (all parts are optional), but should give you an indication of power available to you, again, all without requiring you to write a single line of code.

[1] As mentioned on the Castle site, the original NVelocity project seems to be dead. I have been using the updated version of Castle and recommend you use this version as well.


Posted to Code 
 and tagged as 
nvelocity
,
open-source
,
mvc
,
castle
,
graffiti
,
cs



Similar Posts

Castle Project
Unfuddle == BaseCamp For Developers
What Software do I use on the Mac?

## Facts

- Kind: [Page](https://links.thingelstad.xyz/kinds/page/)

## Same host

- [Life on a Mac - the Grass is Greener](https://links.thingelstad.xyz/links/30e09f333400/) (simpable.com, December 12, 2007)
- [What Software do I use on the Mac?](https://links.thingelstad.xyz/links/fc692afec999/) (simpable.com, December 28, 2007)
- [Six Principles for Making New Things](https://links.thingelstad.xyz/links/c404ab6ba721/) (simpable.com, February 28, 2008)
- [Mix, Twitter, and Hashtags](https://links.thingelstad.xyz/links/b74bbff0a082/) (simpable.com, March 3, 2008)

## Saved the same week

- [Rupert Murdoch, Blogger?](https://links.thingelstad.xyz/links/ecf4f0650681/) (businessinsider.com, May 12, 2008)
- [WordPress Themes](https://links.thingelstad.xyz/links/04058c79aff2/) (themes.barleyhut.com, May 13, 2008)
- [Introducing the Google Maps API for Flash](https://links.thingelstad.xyz/links/1e3c373b2eef/) (googlemapsapi.blogspot.com, May 14, 2008)
- [Twitter Traffic Explosion: Whos behind it all?](https://links.thingelstad.xyz/links/9bd0c1ca1f55/) (blog.compete.com, May 16, 2008)
- [Skim](https://links.thingelstad.xyz/links/f635aa34c9ae/) (skim-app.sourceforge.net, May 18, 2008)

## Elsewhere

- Wayback Machine: https://web.archive.org/web/*/http://simpable.com/code/nvelocity/
