Working with Views and Razor Syntax
All Umbraco views inherit from UmbracoViewPage<ContentModels.NameOfYourDocType>
in the Umbraco.Cms.Web.Common.Views
namespace. If you use the following statement:
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
This gives you access to various properties that can be used in Razor. You can access the properties on the Document Type in several ways:
@Model
(of typeUmbraco.Web.Mvc.ContentModel
): This is the model for the view, which contains the standard list ofIPublishedContent
properties and gives access to the strongly typed current page (of the type you defined in the angled brackets).@Umbraco
(of typeUmbracoHelper
): Provides many useful methods, such as rendering fields or retrieving content by ID, along with many other helpful features.@Html
(of typeHtmlHelper
): This is the familiarHtmlHelper
in ASP.NET Core, enhanced with additional extension methods like@Html.BeginUmbracoForm
.@UmbracoContext
(of typeUmbraco.Cms...