ASP.NET 2.0 and MCMS – implementing page summary controls using a custom SiteMapProvider and a TreeView control

In my previous article I have discussed how to implement site navigation for an MCMS site using ASP.NET 2.0 navigation controls. I have also discussed glitches with such navigation controls when switching between authoring and presenation mode.

Today I will discuss how to create a page summary list as it is usually added to a channel rendering script using the standard ASP.NET 2.0 tree view control with a slightly customized version of my MCMS Site Map Provider.

First of all a page summary list is more or less a navigation control that usually only lists elements in the current channel. Most of the time only postings in the current channel.

The Site Map Provider we developed earlier alwas returns a tree starting at the root channel. For the page summary control we need to ensure that only the elements below the current channel are returned. To achieve this and to ensure that we do not duplicate the work we already did before we will create a Page Summary Site Map Provider that derives from the general Site Map Provider and overrides only the methods that need to be different.

The methods that need to be overridden are the GetRootNodeCore and the GetChildNodes methods.

Here is the complete code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.ContentManagement.Publishing;

namespace StefanG.SiteMapProviders
    public class MCMSPageSummarySiteMapProvider : MCMSSiteMapProvider

        // use the current channel as root node
        protected override SiteMapNode GetRootNodeCore()
            Channel root = CmsHttpContext.Current.Channel;
            return base.GetSiteMapNodeFromChannelItem(root);

        // only list postings in the channel and not sub channels
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
            SiteMapNodeCollection smnc = new SiteMapNodeCollection();

            Channel channel = CmsHttpContext.Current.Searches.GetByGuid(node.Key) as Channel;
            if (channel != null)
                PostingCollection pc = channel.Postings;
                foreach (Posting p in pc)
            return smnc;


This SiteMapProvider will now act as required for a Page Summary control. But what do we have to do to get the TreeView control to not show a Tree but to act as Page Summary control?

The first thing we need to do is to add a new SiteMapDataSource to the template file that points to the SiteMapProvider we just created (and hopefully added to the web.config).

To ensure that the root node – which is actually the current channel – is not displayed in our Page Summary Control we have to switch the ShowStartingNode property of the SiteMapProviderDataSource to false. This will ensure that the datasource feeds the tree view control with only the child nodes of the Root node. So only the postings are now sent to the TreeView control.

Then add a TreeView control to the Template and bind it to the SiteMapDataSource we just configured.

To ensure that the Postings are displayed as a flat list we need to change the MaxDataBindDepth property of the TreeView control to 0. This will ensure that only one level is displayed in the TreeView control – actually a flat list.

To ensure that the expand “+” signs are not displayed and that no space is reserved on the left hand side of the TreeView control we will set the ShowExpandCollapse property of the TreeView control to false.

That’s all! We now can easily add a page summary control to different pages and sites without the need to do any coding – after the SiteMapProvider has been created.

1 Comment

  1. Now after MCMS 2002 SP2 has been released I would like to point you again to an article series I have…


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.