views:

92

answers:

1

With the asp.net mvc web form engine, you could define a content placeholder and specify the default content. How is this done with Razor engine?

This is the only way I found - but it seems like there would be a better way.

_Layout.cshtml:

@if (IsSectionDefined("Footer")) 
{ 
  @RenderSection("Footer") 
} 
else 
{ 
  <text>Default footer text here</text> 
}
+2  A: 

Unfortunately not.

I looked into writing an Html helper but the view isn't available to the htmlHelper and I haven't been able to see a way, at least right away, that would allow you to do it. It might be something worth requesting on http://aspnet.codeplex.com as I've seen others request this functionality on a couple of the blogs.

BuildStarted