Part Types

Overview

TODO

Built-in parts

WebForms ASPX Pages

N2 CMS provides a number of web controls for creating UI with WebForms:

  • <n2:ControlPanel – renders the control panel
  • <n2:Display – displays content from the current page
  • <n2:HasValue – a placeholder that is displayed when a property has a value
  • <n2:Repeater  - a repeater with support for no results
  • <n2:SlidingCurtain – creates a sliding box around the control panel
  • <n2:Tree – creates a tree structure
  • <n2:Zone – renders parts in a zone
  • <n2:ItemDataSource – binds items to grids and repeaters and navigation controls

There are also a number of base classes which helps accessing the current item and integrate witch caching:

  • ContentPage – a page base class with access to the current page
  • ContentPage<T> - a page base class with strongly typed access to the current page
  • ContentUserControl – a user control base class with access to the current page
  • ContentUserControl<TPage> - a base class with strongly typed access to the current page
  • ContentUserControl<TPage, TPart> - a base class used for parts with access to page and part

Look at the WebForms template pack for examples on how to use these controls and base classes. This project provides more web controls and TemplatePage<T> and TemplateUesrControl<T> with additional functionality.

ASP.NET MVC View Helpers

When developing an ASP.MVC view there are some view helpers that can be useful:

  • Html.BeginAsyncAction
  • Html.HasValue
  • Html.ValueEquals
  • Html.ResolveService<T>
  • Html.CurrentPage
  • Html.CurrentPage<T>
  • Html.CurrentItem
  • Html.CurrentItem<T>
  • Html.Detail
  • Html.DisplayContent
  • Html.RenderDisplay
  • Html.DroppableZone
  • Html.ActionLink
  • Html.Zone
  • Html.RenderZone

Example:

<% using (Html.BeginAsyncAction("lazy", new { partial = true })){ %>
     <%= Html.ActionLink("Loading expensive content", Html.CurrentPage(), "lazy", ...
<% } %>

The example shows a link while the lazy action is being retrieved asynchronously from the client.