Is there a better way to specify the contents of the default section in the layouts of the asp.net mvc firewall?

Using the asp.net mvc web form engine, you can determine the content placeholder and specify default content. How is this done with the Razor engine?

I found this example in Phil Haack Defining the default content for the razor layout section - but it seems like there would be a better way.

_Layout.cshtml:

@if (IsSectionDefined("Footer")) 
{ 
  @RenderSection("Footer") 
} 
else 
{ 
  <text>Default footer text here</text> 
}
+5
source share
2 answers

Unfortunately no.

Html-, htmlHelper, , , , . , - http://aspnet.codeplex.com, , .

+2

.. ( ). , MS ? Smth : @RenderSection ( " ",() = >
{

...
})

0

All Articles