Generic Content View

From Sense/Net Wiki
Jump to: navigation, search
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned


The Generic Content View is a special Content View type designed to handle all Content Types. Custom Content Views can be created to present Content of different Content Types, but for Content Types that do not need custom appearance can be shown using generalized Content Views, the Generic Content Views. When a Content is presented with a Generic Content View its Fields are listed using their default Field Controls.

Content presented with Generic Content View


Altough different Content Views can be defined for Content of different Content Types, you don't necessarily have to create new Content Views when you want to present your Content of custom Content Types. An arbitrary Content can always be presented using a Generic Content View.

Content View modes

As a Content can be presented with a Content View in three different modes (New, Edit, Browse) there are three different Generic Content Views defined in the base system for these modes:

  • /Root/Global/contentviews/Browse.ascx: generic browse Content View
  • /Root/Global/contentviews/InlineEdit.ascx: generic browse Content View
  • /Root/Global/contentviews/InlineNew.ascx: generic browse Content View

Field controls

The Generic Content Views will present any Content by listing all defined Fields of the Content using the default Field Control. The default Field Control for a Field is defined by the Field itself, from code - but can be set with the ControlHint property in the Field Setting.

Field order

Fields are listed according to the order of the Fields defined in the CTD. Please note, that Field order can be changed by overriding a Field a child Content Type.

Field visibility

Visible Fields are controlled by the visibility settings in the CTD (VisibleBrowse, VisibleEdit, VisibleNew). Fields marked as Hide are not listed; Advanced Fields are put under the Show advanced fields section and are hidden by default.

Generic Field Control

The Generic Content View itself is a control and can be defined using the following markup:

<%@ Language="C#" AutoEventWireup="true" Inherits="SenseNet.Portal.UI.GenericContentView" %>
<div id="InlineViewContent" runat="server">

Just like a simple Content View, only that it must contain a server side div with the ID InlineViewContent - this is the placeholder for the Field Controls to be rendered.

There is also a control with very similar functionality called the Generic Field Control that can be used to render Field Controls in a Content View. The Browse mode Generic Content View is actually a simple Content View that contains a Generic Field Control for this. The difference is that the Generic Field Control utilizes some features like excluded Fields, Field ordering, etc. When building portals it is highly recommended to use the Generic Field Control, the Generic Content View is a very simple built-in Content View type.


Related links