Razor, Nested Layouts and Redefined Sections

In a recent post I introduced a technique for dealing with optional Razor sections and default content. In this post I will expand upon that technique and describe a way of working with sections across nested layout hierarchies. If you are not familiar with sections, layout pages, or my technique then go ahead and read…


Optional Razor Sections with Default Content

Solution quick links: IsSectionDefined method Razor inline templates RenderSection The new ASP.NET page framework built on Razor (which is available in MVC 3) provides a facility for content pages to contribute named fragments of markup to their layout pages which the layout page can then render in an arbitrary location using the RenderSection method. For…


Fixing area view lookups when using multiple view engines

11/17 Update: I’ve fixed a bug in the view engine registration code that prevented this method from working. Please note the addition of the dummyFormats property in the solution below. Oskar from the ASP.NET forums asked a question about the order of view lookups when using Areas in MVC 3. The problem is that now that…


Granular Request Validation in ASP.NET MVC 3

12/10 Update: In MVC 3 RC 2 SkipRequestValidationAttribute got renamed to AllowHtmlAttribute. I have updated the examples below. A little while ago I wrote a blog post describing granular request validation that shipped in MVC 3 Beta. However, since then we have changed the API for this feature and that post is no longer valid….


Granular Request Validation in ASP.NET MVC 3 Beta

11/9 Update: This article only applies to the MVC 3 Beta release. I have a new post about AllowHtmlAttribute that describes the new APIs and behaviors available in MVC 3 RC and later. If you don’t know already, we have just released the ASP.NET MVC 3 Beta and it brings a slew of new features….


Building custom LINQ expressions made easy with DynamicQueryable.

A colleague of mine recently called me out on the fact that I haven’t blogged in … oh about a year and a half. Well it’s 2010 now and resolution season is in full swing so here’s my attempt at getting back on the ball (no promises though). In a recent post Scott Hanselman described…