Nested Layout Page in ASP.NET CORE

preview_player
Показать описание
In this ASP.NET CORE, i am going to show you, How to use Nested layout in ASP.NET CORE, Its Looking like Master page in ASP.NET WEBFORM
Рекомендации по теме
Комментарии
Автор

I want my "Scripts" section to be rendered in the outer _Layout view.

If I omit the @await RenderSectionAsync ("Scripts", required: false) command in the intermediate _DefaultLayout.cshtml view, the execution ends with an InvalidOperationException run-time error: The following sections have been defined but have not been rendered by the page at ':' Scripts'. To ignore an unrendered section call IgnoreSection ("sectionName").

However, if I insert the IgnoreSection("Scripts"); command into the intermediate _DefaultLayout.cshtml view, the section is not rendered anywhere.

How to ensure that it is rendered in the outer view _Layout.cshtml?


It works! Insert into ' next lines:

@section Scripts {
@await RenderSectionAsync("Scripts", required: false)
}

The section can also be supplemented with scripts specific for this layer.

traplican
Автор

Hello,

I really like your videos, please remember to always enable subtitles like you did in this video.

Thanks!

ccunhax
Автор

not as clear as some other vids on same topic. the fuzz noise in the background I thought was my own fan going bonkers!

pencilpopart