Page types and templates

Templates for sites or display templates for Products can be pointed to an ASP.NET MVC controller instead of an ASP.NET WebForms aspx file.

Attributes

PagePropertiesAttribute

The Litium.Web.Mvc.PagePropertiesAttribute is used on a controller action to define which properties should be avaliable in the editor when a template is connected to the action.

By using the attribute properties can be made visible to an editor per template instead of on all the pagetypes templates (using the "Show in edit mode" setting for the property on the page type).

The attribute has overloads that either take a type that inherits from Litium.Studio.Builders.CMS.PageTypeDefinition (which then maps to all the types properties) or a string array with property names.

PageTemplateAttribute

The Litium.Web.Mvc.PageTemplateAttribute is used to define a page type template and connect it to a page type using code first.

Example action method decorated with both PagePropertiesAttribute and PageTemplateAttribute:

[HttpGet]
[PageProperties(typeof(News))]
[PageTemplate(typeof(News), "~/Site/Images/News.png", Name = "News1")]
public ActionResult Index([NotNull] News currentPageDefinition)

 

 

 

Is this page helpful?
Thank you for your feedback!