Dynamics CRM Customer Portal navigation controls

One of the issues in setting up a CMS based website using the Customer portal for Dynamics CRM was to recreate the Primary and Secondary navigation of an existing site. That site had a primary navigation that was easy to replicate but the secondary navigation was different from most.

In this case, we wanted to have a dynamic menu based upon the pages in the same level folder, ie: a menu that shows ‘sibling’ pages. This allows any page added to a folder in the site structure to automatically appear on the menu.  The customer portal accelerator include a control called CrmSiteMapChildView which is designed to help with dynamic menus by showing all the child pages of any page in the site. With some help from the forum, I was able to use the following code to configure the CrmSiteMapChildView control on a master page to generate a menu that shows all of the pages of the parent folder, thus showing a ‘siblings’ menu.

 /* Conditional formatting for Secondary Nav to show siblings */
 // make sure Control exists and Page has a parent
 if (Children != null && System.Web.SiteMap.CurrentNode.ParentNode != null) 
 {
     string parentURL = System.Web.SiteMap.CurrentNode.ParentNode.Url;
     if (parentURL != "/")  // if parent not top level (Home)
     {
         // Show siblings - Parent page is not root, this is 3rd level or lower
         Children.StartingNodeUrl = "/" + parentURL;
         Children.StartFromCurrentNode = false;
      }

}

 

Many thanks to Nichlas Hayduk of ADXstudio (authors of the customer portal) and gboyer on the customer portal discussions group on codeplex for help on this. Nicholas will be teaching a one day class on the most recent SDK and customer portal in Atlanta on January 21st as part of our January 2011 CRM Training event.  Check check it out!

Steve Noe, MCT

www.bizitpro.com

Advertisements

About stephenvnoe

CRM & XRM solution architect and project lead. I provide CRM design, services, mentoring & support to all manner of front office solutions and CRM projects.
This entry was posted in CRM 4.0, Extending and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s