In ASP.net MVC 5 We can pass section to layout using
@section AnySection{
//section code here
}
and render it in Layout by
@RenderSection("AnySection", required: false)
But how can we pass that section again to a partial inside that layout? See the image below for reference
subheader-v1
is a partial view inside my Layout I have made my Layout with many partial Views.
When I try this as mentioned in Image above it gives me this error
The file "~/Views/Shared/partials/_subheader/subheader-v1.cshtml" cannot be requested directly because it calls the "RenderSection" method.'