We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8
Layout View
Nangarhar University Computer Science Faculty –(NUCSF) 1401/11/13
Outlines 1. What is Layout view in asp.net? 2. Using Layout view 3. View Start Introduction ? ➢ An application may contain a specific UI portion that remains the same throughout the application, such as header, left navigation bar, right bar, or footer section. ➢ ASP.NET MVC introduced a Layout view which contains these common UI portions so that we don't have to write the same code in every page. ➢ The layout view is the same as the master page of the ASP.NET webform application.
➢ For example, an application UI may contain a header, left menu
bar, right bar, and footer section that remains the same on every page. Only the center section changes dynamically, as shown below. What is Layout View? ➢The layout view allows you to define a common site template, which can be inherited in multiple views to provide a consistent look and feel in multiple pages of an application.
➢ The layout view eliminates duplicate coding and enhances
development speed and easy maintenance.
➢The layout view for the above sample UI would contain a
Header, Left Menu, Right bar, and Footer sections. It has a placeholder for the center section that changes dynamically Layout view Using Layout View ➢The views which will be displayed in a placeholder RenderBody() are called child views.
➢There are multiple ways to specify which layout
view will be used with which child views.
➢ You can specify it in a
common _ViewStart.cshtml, in a child view, or in an action method. View Start The default _ViewStart.cshtml is included in the Views folder. It can also be created in all other Views sub-folders.
It is used to specify common settings for all the views
under a folder and sub-folders where it is created. • Set the Layout property to a particular layout view will be applicable to all the child views under that folder and its sub-folders. Its your turn to ask about today’s lecture