views:

171

answers:

2

I'm getting started with .NET MVC. I have experience with C# and I'm getting confortable with controllers and models. I'm however not very knowledgeable when it comes to writing views. I'm struggling to find a good reference on the matter. Available code samples are usually simple and oriented towards demonstrating the overall MVC model. I find available webforms references confusing because of the mixture of event driven controls.

Where can I find a good reference on writing views specifically for .NET MVC? I'm looking for either books, online references or even just really complete sample code.

Thanks

PS I'm assuming that using the default microsoft aspx/ascx <% %> style syntax is the way to go (at least to start). Please let me know if there's important alternatives I need to consider.

+1  A: 

There are alternative view engines for ASP.NET MVC.

NHaml, Spark, NVelocity, Brail

Also have a look at the MVC Contrib project. It includes several view engines.

MvcContrib now offers four (4) alternative view engines for ASP.NET MVC

Developer Art
And how superior would you rate these engines in comparison to the default MS stuff?
Mr Grieves
updated link to nhaml http://code.google.com/p/nhaml/
Simon
+1  A: 

You should acquaint yourself with the NerdDinner HTML tutorial. It gives you an excellent overview of the entire process of building an app on MVC, including some rather complex scenarios.

The sample is an excerpt from a book called Professional ASP.NET MVC 1.0; I'll recommend that too, and it's also available in Kindle format if you want. The book contains quite a few interesting chapters on a multitude of MVC subjects, also about views.

The <% %> syntax is what you want, although alternative view engines exist as already mentioned in another answer. But until you're well familiar with ASP.NET MVC, I would recommend sticking with the basic view engine - it's easiest to find help and samples for that.

I suggest you start with the above references and then ask more specific questions on the parts you don't feel comfortable with. Hope this helps :-)

Jouni Heikniemi
It's a great book. Now I wish I had the time to just read the whole thing. Thanks.
Mr Grieves