Click here to Skip to main content
6,630,901 members and growing! (18,704 online)
Email Password   helpLost your password?
Enterprise Systems » Content Management Server » General     Intermediate License: The Code Project Open License (CPOL)

Microsoft Content Management Server Site Map control (C#)

By Stephen Huen

Displays the CMS channel structure in a hierarchical tree that is expandable and collapsible.
C#, Javascript.NET 1.1, .NET 2.0, Win2K, Win2003, ASP.NET, VS2005, Dev
Posted:26 Apr 2004
Updated:17 May 2006
Views:52,966
Bookmarked:23 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
8 votes for this article.
Popularity: 3.91 Rating: 4.33 out of 5

1
1 vote, 12.5%
2
1 vote, 12.5%
3
1 vote, 12.5%
4
5 votes, 62.5%
5

Sample Image - sample.gif

Introduction

For use in Microsoft Content Management Server, this Site Map web control, written in C#, displays channel and posting structure in a hierarchical tree that is expandable and collapsible when viewed in a IE4+ or NS6+ browsers. When viewed in NS4, the tree is fully expanded. The starting channel is configurable, so you can have multiple instances of the control in one page, rendering different portions of a site if so desired.

A VB.NET version of this control is available here.

Description

The web control has several public properties:

  • StartChannelPath - Optional. Starting channel path. Default is "/channels/".
  • ImagePath - Optional. IIS path to the three icons. Default is "/<MCMS Site Application Name>/images/".
  • JavascriptPath - Mandatory. IIS path to the JavaScript file SiteMap.js. E.g.: "/<MCMS Site Application Name>/Includes/".
  • ExpandMap - Optional. Fully expand the channel and posting tree on first load. Valid values are true and false. Default is true.
  • SortChildrenBy - Optional. Display order of channels and postings in tree. Valid values are "Display Name", "Name", and "Ordinal". Default is no sorting.
  • ShowPostings - Optional. Display postings in the tree. Valid values are true and false. Default is false.
  • DefaultPostingName - Optional. When ShowPostings is true and there is default posting for the channel, specify the default posting name to hide the default postings from the tree. For example, "default".
  • ShowDescription - Optional. Show channel and posting descriptions in hyperlink tooltips. Valid values are true and false. Default is true.
  • MaxLevels - Optional. Show the specified number of channel levels only. Default is "0" which shows all channel levels.

Installation instructions

  1. Copy SiteMap.cs to the web control directory of your MCMS site.
  2. In your SiteMap template, register the control, include SiteMap.css, and insert the control. For example:
    <%@ Register TagPrefix="wc1" 
      Namespace="QuestechSystems.WebControls"
      Assembly="Web Control Library Assembly Name" %>
    ...
    <head>
    ...
    <link rel="stylesheet" 
      href="/<MCMS Site Application Name>/style/SiteMap.css" 
      media="all">
    ...
    </head>
    ...
    <wc1:SiteMap id="SiteMap" runat="server" StartChannelPath="" 
      JavascriptPath="/<MCMS Site Application Name>/Includes/" 
      ExpandMap="" SortChildrenBy="Display Name" 
      ShowPostings="true" DefaultPostingName="default"
      ShowDescription="" MaxLevels="0">
    </wc1:SiteMap>
    ...

    If your like the Expand All and Collapse All links as shown in the above picture, add links to the template like:

    <a href="#" onclick="actionLayer(true);return false">Expand All</a>
    <a href="#" onclick="actionLayer(false);return false">Collapse All</a>

    Note the media="all" attribute in the stylesheet reference. It prevents NS4 from reading it, as SiteMap.css is not compatible with NS4. If you don't care for NS4, you can also copy the content of SiteMap.css and add it into your site stylesheet.

    Please check if there are any conflicts between your site stylesheet and SiteMap.css. For example, the sample site WoodgroveNet messes up the rendering quite badly.

  3. Copy channel.gif, channelopen.gif, and channelclosed.gif into the image directory as specified in the property ImagePath.
  4. Copy SiteMap.js into the directory as specified in the property JavascriptPath.
  5. Rebuild the solution in VS.NET.

History

  • V1.0 - 2004.04.26 - Base.
  • V1.1 - 2005.02.12 - Added an option to limit the channel depth. (Please note that the namespace and class names have changed.)
  • V1.2 - 2005.03.13 - Added an option to show the postings in a tree. (Please note that the CSS class names have changed.)
  • V1.3 - 2005.04.15 - Fixed NullReferenceException when control is used on a non-template page.
  • V1.4 - 2006.05.14 - Added an ASP.NET 2.0 version.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Stephen Huen


Member

Occupation: Web Developer
Company: Questech Systems
Location: Canada Canada

Other popular Content Management Server articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 2 of 2 (Total in Forum: 2) (Refresh)FirstPrevNext
GeneralSlight bug PinmemberRick Mason3:53 15 Apr '05  
GeneralRe: Slight bug PinmemberStephen Huen8:11 15 Apr '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 17 May 2006
Editor: Smitha Vijayan
Copyright 2004 by Stephen Huen
Everything else Copyright © CodeProject, 1999-2009
Web22 | Advertise on the Code Project