I’m currently in the planning stages for a web application that I’m planning on building on top of the ASP.NET MVC extensions, and am trying to figure out which view engine would be best.

The three that I’ve looked at so far have been the standard ASP.NET WebForms, NVelocity and NHaml. I kinda like what I see in NVelocity and NHaml, but the documentation and support appears to be a little bit lacking. I had a hard time trying to figure out how to get started and up-and-running with either of them (though I’m sure I could figure it out if I spent more than an hour or so with either one). So for the most part, I’ve been kinda leaning towards just using WebForms.

Can I really trust WebForms with my HTML though? I really don’t like what it does behind-the-scenes with the markup that’s returned to the client from the server. Just today, I wrote some code to programmatically disable a radio button on a page under certain conditions. The result was that the formatting of my form was *completely* jacked up. Why? (these aren’t the only reasons…we have some pretty serious stylesheet issues involved here as well, but that’s another story that I won’t get into right now) Because the WebForms engine decided that not only should the disabled property of the input tag for the radio button be set to "disabled" (as it should…as I expected), but it ALSO decided to wrap the radio button input tag with <span disabled="disabled"></span>.

!?!?!!

What is THAT? I mean, its bad enough that it unnecessarily wrapped the input tag with a span tag, but it also applied a non-standards-compliant attribute to the tag too ("disabled" is NOT a valid attribute for a span tag). I’m pretty picky about my code…and I try to keep it as close to standards-compliant as possible. I’m just not sure I trust WebForms to be able to generate markup that I’d be OK with.

I mean, I know I *could* use WebForms and just write my own markup and use server tags to inject data where I want it, but what’s the point? If I’m going to do that, why not just use an alternate view engine that will handle all of that for me *and* generate valid markup?

Anybody have any thoughts on this? Experience with any alternate view engines for an ASP.NET MVC app? Is getting off the ground with NVelocity or NHaml easier than I thought? Are there others? Any and all feedback on this would be greatly appreciated.