I created a control that generates a breadcrumb string. The code is below. You’ll need to add a reference to it to your area definition template pages.
namespace ASI.PortalLibrary.WebControls {
using System;
using System.Collections;
using System.Security.Principal;
using System.Text;
using System.Web;
using System.Xml;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Portal;
using Microsoft.SharePoint.Portal.Topology;
using Microsoft.SharePoint.Portal.Security;
using Microsoft.SharePoint.Portal.SiteData;
using Microsoft.SharePoint.Portal.SingleSignon;
using Microsoft.SharePoint.Portal.WebControls;
using System.DirectoryServices;
using System.Text.RegularExpressions;
using ASI.Utils;
using ASI.Utils.Security;
/// <summary>
/// Control that handles searching for contacts
/// </summary>
public class BreadCrumbControl : System.Web.UI.UserControl {
private PortalContext m_PortalContext = null;
private void Page_Load(object sender, System.EventArgs e) {
}
protected override void Render(HtmlTextWriter output) {
// Return the currently logged in user
string breadCrumbString = "";
string strTitle = "";
string url;
int depth = 0;
m_PortalContext = PortalApplication.GetContext(this.Context);
bool hasParent = true;
PageInfo pi = (PageInfo)Context.Items["SPS_PageInfo"];
Guid currAreaGuid = pi.CategoryId;
Area currArea = AreaManager.GetArea(PortalContext.Current, currAreaGuid);
strTitle = currArea.Title;
url = currArea.Web.Url;
breadCrumbString = "<a href=\"" + url + "\">" + currArea.Title + "</a>";
while(hasParent) {
try {
currArea = AreaManager.GetArea(PortalContext.Current, currArea.ParentID);
url = currArea.Web.Url;
breadCrumbString = "<a href=\"" + url + "\">" + currArea.Title + "</a> >> " + breadCrumbString;
strTitle = currArea.Title;
} catch (System.Exception exc) {
hasParent = false;
}
}
output.Write(breadCrumbString);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e) {
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}