I have following code snipped in _Layout.cshtml
<div id="sub-navig-container">
@RenderSection("subNavig")
</div>
<div id="text-content">
@RenderBody()
</div>
when i add in my view
@section subNavig
{
//some code
}
it is work good, but when I write this in _ViewStart I have an error:
The name ‘DefineSection’ does not exist in the current context

Please explain why, and if possible tell how can I fixing this issue
_ViewStart is a special view which derives from
ViewStartPageinstead ofWebViewPagewhich other views derive from. And theViewStartPageclass doesn’t have aDefineSectionmethod. So you cannot define sections in this file. You could provide default contents to this section in the layout directly: