Thursday, November 13, 2008

Adding BreadCrumb Navigation to SharePoint Application Pages

With the help of following Blogs I was able to get BreadCrumb on to the SharePoint Applications pages.
http://weblogs.asp.net/jan/archive/2008/04/16/adding-breadcrumb-navigation-to-sharepoint-application-pages-the-easy-way.aspx

http://www.novolocus.com/category/sharepoint/branding/breadcrumbs/
And some additional links which can be done through object model code.
http://blog.thekid.me.uk/archive/2007/01/17/configuring-the-breadcrumb-for-pages-in-layouts.aspx

http://www.mikhaildikov.com/2007/05/creating-dynamic-breadcrumbs-in.html

But the requirement from the client was that they want to see default.master with the SharePoint Application Pages and not Application.master. as we all know that all SharePoint Application pages uses application.master and not default.master page. I have googled for some time and found this wonderful Blog from Jan Tielens which helped me to change the master page from application.master to default.master.
http://weblogs.asp.net/soever/archive/2006/11/14/SharePoint-2007_3A00_-using-the-masterpage-from-your-site-in-custom-_5F00_layouts-pages.aspx

This took me in to new problem. The above technique for adding BreadCrumb navigation bar does not work. Then I have played around for some time and figured out the problem. BreadCrumb Navigation bar was not comming since I was changing the master page on the fly through code on page OnPreInit event. Technique mentioned in the above blog posts works for SahrePoint Application Pages only if the master page is application.master and not default.master. So I have learned that application.master uses "SPXmlContentMapProvider" as SiteMapProviser and default.master uses "SPContentMapProvider" as SiteMapPrivider. This helped me to solve the problem. I have just provided "SPXmlContentMapProvider" as SiteMapProviser as source for my default.master in the following way.

SharePoint Application Page Template



Code Behind

using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace YourNameSpace
{
public class ClassName : PageBase
{
///
/// Variables declaration which includes control names in the .aspx page template
///

///
protected override void OnLoad(EventArgs e)
{
}
}
}

No comments:

Post a Comment