Showing posts with label Master Page. Show all posts
Showing posts with label Master Page. Show all posts

Saturday, May 18, 2019

ViewModel, Partial Views and Layouts in Asp.Net Core

Layout in Asp.Net Core MVC Views

Every page on a website will have some common elements like Header, Logo, Menu, Navigation links etc. A layout helps to create a common view for these re-usable part of the page and use it in each page of the application.

A layout is also a view with .cshtml extension. The layout view defines the header, content area and the footer sections. In general re-usable content is placed in the header and footer sections, the content section varying content of the pages. The content section contains a statement @RenderBody(), which embeds the varying content of each page in the content section.

A typical layout view page looks like this.