Please help us by completing this survey

Go to survey

Docs / Development / Portlet


Prerequisites: this article is about a feature that requires the SenseNet.WebPages component or the full sensenet 6.5 application to be installed.

A Portlet is an ASP.NET web control that appears as a box on pages. Portlets can display custom layouts and implement custom application logic. The most simple portlets are used to present a single Content or Content Collections. Pages in sensenet are mostly built up of Portlets - they are the basic building blocks of Pages.

Building custom pages is done by placing various types of portlets in the page layout. A portlet can display a custom user interface and execute custom code (for example the Login Portlet that accepts credentials of users and logs them into the portal) or portlets that rely much on the ECMS features of sensenet to present Content or Content Collections.

List of built-in portlets

There are many pre-defined portlets in the portal. These include the most basic applications and portlets that are necessary when building pages upon the Content Repository.

Adding portlets to a page

Portlets can easily be added to pages after editing the page and clicking on the Add portlet link placed at the top side of the different portlet zones. When clicked, a Content Picker will pop up and the portlet can be selected from pre-defined categories.

Add portlet

Added portlets are only visible to the public when the page has been checked-in (and in case versioning or approval of the page is switched on, it is also have to be published/approved). Pages can be edited using the Portal Remote Control (PRC). After they are added, the properties of portlets can be set to customize their look and behavior.

Editing portlet properties

Portlets can be customized via their properties. Properties can be accessed and set in the portlet properties dialog displayed after clicking Edit in the dropdown box that appear at the top right corner of the portlets when the page containing the portlet is in Edit mode. In the portlet properties dialog properties are organized into tabs along function categories.

Portlet property dialog

Common properties include the ones displayed on the above screenshot:

The available list of properties depend on the type of the portlet.

When portlet properties are saved, some changes only take effect after a postback on the page - it is strongly advised to use the Preview mode functionality of the PRC after changes have been made to portlet properties.

Cacheable portlets

Some portlets support caching of their generated html output. When a portlet is cacheable, a Cache tab will appear on the portlet properties dialog. When caching is enabled the portlet will cache its output for the given interval and thus when rendered no background logic will be executed within the cache interval. With this technique page response time can be lowered significantly.

It is strongly advised to use the cache functionality of portlets when available on live sites. Portlets that are not being cached may cause pages to be less responsive even at small visitor rates.

- Cache is only enabled for visitors and logged in users that are not member of special kind of content administrator groups. 
- These groups are enumerated in the web.config under the "AdminGroupPathsForLoggedInUserCache" key in the sensenet/cache section. 
Context bound portlets

Some portlets support context binding functionality. This means that the output of the portlet depends on the Content being bound to the portlet. Specifying the Content (also referred to as the context) on which the portlet will execute its custom logic can be adjusted via properties of the Context binding tab that appears in the portlet properties dialog for context bound portlets. These portlets are the basic building blocks for creating Smart Pages - pages that are able to present a whole set of Content with the same layout.

Always use Context bound portlets to take full advantage of the Smart Application Model.

The properties to fine adjust context binding are the following:

Context bound portlets are cachable portlets by design.

Portlet inventory

Every Portlet has a content that represents it in the /Root/Portlets folder, organized by category. This makes it possible for the users to adjust the behavior of the add portlet dialog. Portlets and categories can easily be managed in Content Explorer as they build up a simple 1-level tree folder structure. Administrators can move portlets from one category to another, fine adjust Portlet visibility permissions for page editors or even delete Portlet Content so that it does not appear in the add portlet dialog. After deleted, you can always reinstall any portlet using the Synchronize Application (see next section below).

Please note that the inventory only controls the visible items in the add portlet dialog and moving / deleting Portlet content has no effect to portlets already added to pages.

Installing portlets

Only those portlets are visible in the add portlet dialog that are available in the Portlet inventory. Therefore when a new Portlet is created and added in the webfolder in the form of a dll file, it has to be installed to the Content Repository. This can be done either by manually creating a new Portlet Content under the /Root/Portlets folder in the appropriate Category folder, or automatically, using the Synchronize action. The latter is defined as a link on the /Root/Portlets folder in Content Explorer.

Syncronize portlets

Is something missing? See something that needs fixing? Propose a change here.