ASP.Net 2.0 Navigation and SharePoint v3

Jon Hello everyone, Jon here again with a quick tip. If you have ever wanted to use the new navigation features of ASP.Net 2.0 in your site, you might have noticed that it doesn't work in the way described by the tutorial when you are on a SharePoint v3 based site. The key is that you need to specify the SiteMapProvider that you want, because SharePoint sets the default sitemap provider to be SPSiteMapProvider. If you want the standard non-SharePoint behavior, you should specify SiteMapProvider="AspNetXmlSiteMapProvider" on your asp:SiteMapDataSource.

<asp:TreeView runat="server" id="MyTreeView" DataSourceID="MySiteMap"/>
<asp:SiteMapDataSource runat="server" ID="MySiteMap" SiteMapProvider="AspNetXmlSiteMapProvider"/>


Comments (8)

  1. Dion says:

    Thanks Jon,

    I’ve been working on this lately. The missing piece for me is how do you tell the datasource which xml file to use? Does the name have to match the ID?

  2. What would be really helpful, and has been asked for repeatedly since SharePoint 2001 is either native Designer functionality or an add-on that allows one to pick from a wide range of nav styles, adjust the style (vertical, horizontal, have many levels to cascade, etc.) then tie it to the prover, all in a drag and drop environement. This should be a Designer tool function not handcrafted code.

  3. Jon Campbell says:

    Dion – I think you have to modify your web.config to get the provider to point to a different file. You will want to find the providers section and add a new provider, or modify the existing AspNetXmlSiteMapProvider. Here is some sample markup that should be pretty close to what you need.



           <add name="MyFileXmlSiteMapProvider"

                 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"





  4. Jeff Berg says:

    We just went through a very painful exercise to apply styles to the left nav.  Mostly because the nav is positioned using embedded tables – not CSS.  Needed to parse and re-render the HTML to get the background changed across all the rows in the multiple tables that make up the currently selected item.  Time consuming development effort and runtime performce issue too.

    I’ve heard this from numerous other who try to mess with customizing the navigation.

  5. Jon Campbell says:

    Jeff: ouch! I feel your pain – that is definitely an area where we can do better. If you haven’t found it already, definitely check out – its a fairly clean masterpage that you can use as a starting point for customization of the look and feel. From what I have seen its an ideal way to get a DIV based layout for your page. Also, has some resources about branding that might help you with the styling of specific controls on the page like the left nav.

    If those resources don’t help, then please file a bug at or let us know more about the issue so we can evaluate the situation.


  6. elegault says:

    Regarding the limitations customizing the QuickLaunch: I noticed that you have a little more flexibility with design if you simply use the base Menu control and tie it to the SPSiteMapProvider.  But unless I am missing something, the key limitation is the inability to customize the raw HTML that’s rendered for a particular element, like in LevelSubMenuStyles.  Ideally I’d like to wrap a level in <DIV> tags so that DHTML can hide/show or collapse/expand the next level.  But we are only given a small set of named properties to work with.

  7. Henrik Weimenhög says:

    The code bloated default navigation needs a sleek replacement indeed. I am currently trying to implement in my Sharepoint installation. It seems promising as it allows me to style it using CSS.

    Anyway, since I may have the attention of someone from the Sharepoint team, please read the blog entries at and as it provides good feedback on how the community wants Sharepoint to evolve.


Skip to main content