Saturday, November 27, 2010

Ssssshhhh - don't tell anyone but I'm enjoying web dev with ASP.Net MVC3 and Razor

Just very impressed at the moment that my ViewModels are flying in/out of my Controllers with quite a lot of ease...

Also impressed with how clean Razor feels compared to old ASP.Net

Also impressed with how easy it is to extend the Expression<> based HtmlHelper code.

...

A couple of things I've done that show how I'm techie enjoying myself:
1. Enabling email verification was easy -  mainly thanks to Kevin at http://thekevincode.com/2010/09/adding-email-confirmation-to-asp-net-mvc/ 

2. Creating enum based drop down select boxes was easy - just used http://blogs.msdn.com/b/stuartleeks/archive/2010/05/21/asp-net-mvc-creating-a-dropdownlist-helper-for-enums.aspx - then in Razor:

@using MyExtensionsNamespace

Some HTML

@for (var i = 0; i < Model.MyProperty.Count; i++)
<div>
@Html.EnumDropDownListFor(model => model.MyProperty[i].MyEnumField)
</div>
}

3. Using list collections was easy - see the snippet above - it just works when you then collect the ViewModel back in to the Controller Action method too :)

4. Adding my own Model error was easy with ModelState.AddModelError 

No comments:

Post a Comment