Skip to content

October 18, 2005

Picking up the SharePoint Services Navigation Controls

When you get into modifying site definitions you’ll run into a few interesting challenges.  Not the least of which are all of the different versions of a page that you’ll have to update in order to make the whole site to fit together.  One of the interesting aspects is the list pages.  Each list has it’s own set of pages.

On those list pages are some web controls that control view navigation and another one that controls the related links — both of them are on the left side of the page.  If you want to get to one master page without modifications these web controls present a problem.  (In other words, I want to manage one aspx page and be able to copy that into each of the files in each of the lists.)  Those pesky web controls make that not possible.

However, there is a solution.  You can encapsulate the ViewNavigation and RelatedLinks classes in the Microsoft.SharePoint assembly into web parts and use them as web parts.  In that way, you can change the left column to a site navigation web part zone and then insert web parts for ViewNavigation and RelatedLinks on the pages that happen to be list pages.  Then you can insert your own navigation above or below these standard web controls — and you can swap them out later without having to deal with the “thou shall not modify a site definition after it has been created rule.”  (I may have paraphrased that a bit.)

In general it looks like the WebControls in the Microsoft.SharePoint.WebControls namespace will encapsulate well into web parts so you can reuse the built in web controls — even if you want to move to a web part basic design.

As a sidebar, the Microsoft.SharePoint.Portal.WebControls seem to all derive from WebPart so you won’t even have to encapsulate them.  All that’s necessary there is to create a DWP file.

The common administrative pages are still a challenge — but it’s getting easier bit by bit to create a cohesive site definition.

By the way, here’s the entire file I used to encapsulate the RelatedTasks web control…

using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;

namespace SPBuiltInControls
/// <summary>
/// Shell for Related Tasks web Control
/// </summary>
[ToolboxData(“<{0}:RelatedTasks runat=server></{0}:RelatedTasks>”),
public class RelatedTasks : Microsoft.SharePoint.WebPartPages.WebPart
protected override void CreateChildControls()
base.CreateChildControls ();
Microsoft.SharePoint.WebControls.RelatedTasks related = new Microsoft.SharePoint.WebControls.RelatedTasks();

… I got lazy and didn’t even bother removing the extra using statements…

Article: Caught Up in Code, or Quick Configuration

Many new programs are starting to blur the lines between something that should be enforced through specific flow control in code and when it’s the right decision to allow some decisions to be made by the configuration of the software. Here, you’ll explore that line and how it impacts your development.

Code is Well Known

Most developers and architects default to creating solutions for their problems directly in code. They put an “if…then” statement in the code and call it business logic. For example, if there is a specific property available, then the application must show an additional link. If the property shows that the user is a member of a certain group, then an additional menu may need to be displayed.

Situations like these arise every day. Creating a simple “if…then” statement is the obvious solution to the problem. But is the obvious solution always the right one?

Configuration Is Quick

Configuration, rather than a quick “if…then”, maybe the answer. Configuration is focused on creating ways to simplify individual business logic into a set of values that can be stored as configuration rather than hard coded into the logic of the program. Configuration is converting hard-coded logic into data that the program can operate on.


Recent Posts

Public Speaking