Depending on whether your layout has an alternative for undefined sections or not, you can simply cancel @if
and @section
@section Navigation{ { @if (isReal) @{Html.RenderPartial("NavigationForInput");} } }
If you just want to leave the navigation, this should be fine, but it will not work if you use IsSectionDefined ("Navigation") in your layout, as it will always return true.
source share