Watch video

What is a view?

A view is the second part of the MVC pattern. It is with the view that you control the markup on the website - that is, how your code is presented on the frontend, to the user!

Views can be divided into two: 

  1. Views and
  2. Partial Views

If you are using the premade project to follow along with this chapter you will notice that the view for the form has already been created. However, this view consists only of a static form made entirely out of HTML.

Now, in this video, you will be creating a new view for the form - more specifically, a new Partial View. Later on in the chapter, this Partial view will be used to replace the current HTML form.

In order to take advantage of IntelliSense by using "strongly typed models", when working with the views on your project, it is recommended that you enable ModelsBuilder - see relevant resources and links below for more information on this.

 


 

Resources

Check out the resources below to learn more about MVC and MVC in Umbraco.

Template project and ModelsBuilder

In the template project, the ModelBuilder is enabled. The project is configured to use the `LiveAppData` ModelBuilder mode.

The project is also configured to store all PublishedModels - the models generated automatically by Umbraco, in a folder called "PublishedModels".

If you're using your own project to run through this chapter, make sure to use the same or similar ModelsBuilder configuration.

    <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="LiveAppData" />
    <add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/PublishedModels" />
    <add key="Umbraco.ModelsBuilder.AcceptUnsafeModelsDirectory" value="true" />

 

Project login details

User: tv@umbraco.com
Password: 1234567890

Surface Controllers

Total Time: 01:18:05

In the Surface Controllers chapter, you will learn more about some of the key functionality in Umbraco and how you can use MVC to programmatically add content and media to your Umbraco website.