Parts

Here we'll examine how to display items defined through composition. There were two scenarios; a single property on the page and the concept of items in zones. But lets first take a look at how the teasers's user control is built:

Creating the user control

To start with, create a user control in the location defined by the definition class, e.g. /Uc/Teaser.ascx. Thean head over to the code-behind file and change the base class to the generic one. This gives us access to the CurrentItem property referring to the item instance and the CurrentPage property referring to the currently displayed page. 

User control's code behind

This is is the designer file. In this case we just output the teaser's target url and title in an anchor.

User control's design view

To learn how to make this user control to be added dynamically to the page read on.

Single property on the page 

To display a single item added to a page using the editable item attribute we can use the display control, like this:

The display control

Items in zones

To display zero or more items in a zone we use the zone control:

The zone control

Both the display and the zone controls also have a path property that can be used to change from where the items are fetched. This could be used to have parts on the start page display on all pages. Just set the Path="/".