Friday, October 29, 2010

The best overload for 'RenderSection' does not have a parameter named 'optional'

I've been taking a look at asp.net mvc 3 beta with razor view templates.

some of the examples on the net are from previous releases and things have changed; one that I came across was the RenderSection method which can be used in layout (master) files

@RenderSection("Header", optional:true)
will throw an exception

The best overload for 'RenderSection' does not have a parameter named 'optional'
the newer syntax for rendering an optional section appears to be

@RenderSection("Header", false) 

1 comments:

giddy said...

The parameter name has been renamed to required actually =P