View Components, View Models, and Partial Views

The customer example presented thus far shows working with a complete model class (Customer) and single views (Index, Create, Edit) that represent a full page. However, there are times when you need to reuse part of a view across different pages. For these occasions, ASP.NET allows you to create partial views and the new view components. Similarly, you may find yourself needing only a portion of a model class or a mix of a couple different objects and their properties. This is often the result of a specific view that does not map well to your individual model classes. In this case, you can create a view model. Let’s take a look at each of these modular components.

Partial View

A partial view is ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.