TOC

The community is working on translating this tutorial into Persian, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".

Layout:

Introduction

Ever since the first website was created and expanded from a single page to several pages, the need to share specific parts of the pages became obvious. Use cases for this ranges from having the same footer at the bottom of each page belonging to the same website, to re-using very complex layouts, meta data and everything else around the actual content of a web page.

Various server-side technologies have solved this problem in different ways, from the include() statement of PHP to the MasterPages technology of ASP.NET WebForms. They all come with their own set of advantages and disadvantages, but they all solve the same problem: They allow you to re-use all the stuff that would otherwise have to be repeated in each file (and even worse: manually edited in each file for even the smallest, global change) and only specify the unique content for each of your pages.

In ASP.NET MVC, you can use something called a Layout, often in combination with Sections. You can have one or several Layouts in your project and each can include zero or more Sections. We will go through all the various Layout-related concepts in the following articles.


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!