Join Jess Chadwick for an in-depth discussion in this video Reuse shared HTML markup with layouts, part of Learning ASP.NET Core MVC.
- [Instructor] Navigate around the Explore California site…a little bit and notice how every single page…contains the same common sections,…such as the header, footer,…and even the left sidebar section of the page.…This is a great thing,…as it gives a consistent look and feel throughout the site.…However, it's really painful to change…each instance of those common elements…across all pages in the site.…Luckily, ASP.NET Core MVC allows us to define…special Razor pages whose sole purpose it is…to define this common layout…and render content from individual pages…inside of this layout.…
These type sort of Razor pages are referred to as layouts,…and they're a great candidate…to live in that shared Views folder we saw…ASP.NET Core MVC looking for earlier.…To demonstrate how they work, let's create…the new Shared folder under the Views folder.…Then, I'll make a copy of our index.cshtml page…into this new Shared folder and rename it _Layout.cshtml.…Now, there's nothing special about the underscore…or the layout in this file name.…
- Building blocks of ASP.NET Core applications
- Creating a new project
- Responding to HTTP requests
- Serving static files
- Understanding the MVC pattern
- Handling requests with controllers
- Rendering HTML with Razor
- Rendering data, view markup, and view logic
- Creating HTML forms
- Validating form data
- Reading and writing from a database with Entity Framework
- Improving the user experience
- Exposing data with a web API
- Securing your ASP.NET application
Skill Level Intermediate
1. The Basics
2. The Model-View-Controller (MVC) Pattern
Understand routing4m 24s
3. Render HTML with Views
4. Work with Data
5. Improve User Experience with Ajax and Web APIs
6. Secure Your Application
Next steps1m 42s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.