Tuesday, August 26, 2008

Wire Up a Custom SiteMapProvider

So now that you have used the last post to create a custom site map provider, let's take a look at how to wire it up.

First, open up your web.config and find the area. Inside the , place the follwoing:

add name="Your NewMainProvider" type="ShannonBray.MOSS.MenuProvider.MenuProvider, ShannonBray.MOSS.MenuProvider"

Note: The above is assuming you compiled the dll into an assembly named 'ShannonBray.Moss.MenuProvider'. You will need to change this to fit your naming convention.

Now, you need to create a SiteMapDatasource. You will put this on the page that you plan on using the new navigation on. (Maybe your MasterPage)

asp:SiteMapDataSource ShowStartingNode="False" SiteMapProvider="SPNavigationProvider" id="topSiteMap" runat="server" StartingNodeUrl="sid:1002"



Now you can bind your menu or tree view to the datasource and see it in action.

0 comments: