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?
I found this example in Phil Haack's Defining Default Content For A 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>
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With