Select Page

Distilled from Scott Hanselman’s Blog ASP.NET MVC 2 Ninja Black Belt Tips by Scott Hanselman

T4 Templating

  • In VS 2010 you can D/L & Install the Tangible T4 editor extension
  • Use the T4MVC templates from“>MVC Contrib on“>Codeplex
  • Set the <:MvcBuildViews> element to true in the MVC project file. Unload the project in the Solution Explorer (Right Click Project), Edit the csProj (again right click project). This forces the views to be compiled as well.

View Engines

  • Spark A quite popular View engine, looks more like HTML with extensions. Site on CodePlex
  • NHaml This is a very brief syntax entirely different to the HTML style used by the MS WebForms View Engine used in MVC. Based of the Ruby HAML view engine. Not hugely popular

Editor Templates

You can create Editor Templates that conventionally replace any existing control used by the Html.***For helpers (EditorFor, TextAreaFor, DropDownListFor, EditForModel, etc.). There is a DisplayTemplates folder for ViewFor (ViewForModel) variants as well. You can use these to build View & Edit Templates for complex types as well

%d bloggers like this: