I know there was a thread on SP1 that was referring to issues with the sitemap. I think the issue is still there in 4.1. Here is the setup that is failing.
I created a brand new 4.1 site. I added one page and three subpages. I used the I created a brand new 4.1 site. I added one page and three subpages. I used the "Right Sidebar, Header, Footer" template for all pages. I then went to the "Right Sidebar, Header, Footer" template and added a Site Map Data Source control and set the starting node offset to 1. I then added a rad panel bar and set it's datasourceid property to the id of the Site Map Data Source. When viewing any page, the panel bar is not being populated.
Is there a fix for this?
I also decided to try and use the NavigationControl and set the type to vertical and then set the page display to "All sibling pages of currently opened page". I then navigated to my top level page and the navigation is still not showing.
Edit: the NavigationControl works. I just had to re-publish my pages for the template changes to apply. This was something that was figured out in another forum post. Shouldn't the cache for the pages be cleared if you update a template?
After some digging around, I found that the only way that I was able to get the RadPanelBar control to work was to implement it into the NavigationControl. I created a new class that inherited the IExpandableSiteMapControl interface and also inherited the RadPanelBar. I then added the appropriate methods that the interface require. After getting my control to compile, I then downloaded the NavigationControl.ascx from Reflector. This allowed me to edit the template and place my panel bar control in the conditional template that had a right side value of CustomNavigation. Using the new control, I was able to set the Sitemap properties I wanted and the panel bar finally worked.
I still think that we should be able to just drop the RadPanelBar and SiteMapDataSource controls on a page and hook the two together and it should work. So I still think that this is a bug, but have found a workaround for our situation. I guess if you wanted, you could replace the control for any of the ConditionalTemplate nodes.
I am guessing, but I would assume the reason that the SiteMapDataSource is not working is because of the incorrect provider? I was looking through the SiteMapDataSource to see if there was something that I could override to get this functionality. The only thing I could think of was the Provider. Looking at the code for the NavigationControl, it appears the control is using the standard SiteMapDataSource, but it is also setting the Provider. This is where the idea came from. Rather than re-creating the SiteMapDataSource and setting the Provider as is in the NavigationControl, I just decided to create a new SiteMap navigtion control which is what I did for the RadPanelBar.
Hello Richard Baugh,
I've attached a sample video showing my setup of SiteMap DataSource and RadpanelBar. Can you please try setting the SiteMap's property ShowStartingNode to False, instead of using StartingNodeOffset 1? Generally there should be no problem using the described functionality - please try it and make sure that the DataSourceID in RadPanelBar is set appropriately - this might be the case, as well. If the problems persist, or you are testing with a different use case scenario than the one I've used in the video, please write back.
Concerning the issue with templates not applying until you republish the page, please excuse us for the inconvenience - we have registered this behavior as a bug and are working on fixing it. You can track the bug status and vote for it in PITS on this URL.
the Telerik team
Thanks for the reply. We are using it in a different scenario. We are adding the RadPanelBar and SiteMapDataSource to a Page Template. So we need to set the StartingNodeOffset to 1 since we want it to only show the the navigation starting from the second level on. Your example is on a page so you can set the starting url.
With the workaround I posted about, I am using the NavigationControl and just changed out the ascx file with one that uses this new control derived from the RadPanelBar and the IExpandableSiteMapControl interface. When I add the NavigationControl to the page, I simply set the CustomLayoutTemplatePath to the ascx file, and then I set the StartingNodeOffset to 1. This works just fine, but if I try to add the SiteMapDataSource and RadPanelBar and set the SiteMapDataSource to StartingNodeOffset to 1, then I don't get any navigation.
As for the ShowStartingNode, it is set to false also. The problem is that we are adding this to a template and can't specify the StartingNodeUrl like you have on the page. Try moving your RadPanelBar and SiteMapDataSource to a Page Template and then set the ShowStartingNode to false, and the StartingNodeOffset to 1. Ideally you should get the same results as what is in your video, only the controls are on the template. Then it would allow you to add another top level section and the panel bar in the template would also work for the other section. From my original post, I stated that I tried this in an upgraded site and also on a fresh 4.1 and both failed to show the navigation when the controls combo was added to a template.
From what I can see, the only difference from the normal SiteMapDataSource and the SiteMapDataSource that is used in the NavigationControl, when set to CustomNavigation and no other settings except the StartingNodeOffset, is that the NavigationControl also sets the Provider of the SiteMapDataSource through the GetProvider which uses the SiteMapBase class that was mentioned in another post as a fix for getting the correct current page and such.
If I need to create a ticket and attach the files I can, but there really isn't much that I have done other than adding the RadPanelBar as the option for the CustomNavigation conditional rather than RadSiteMap that is in the Sitefinity build.
Hello Richard Baugh,
Thanks for getting back to me. Generally setting the StartingNodeOffset through the UI does not work properly (indeed due to the Provider not being set, as you correctly observed) . Please take a look at the attached sample control which uses RadPanelBar and SiteMapDataSource with StartingNodeOffset set to 1, and setting properly the SiteMapProvider through code. I've tested using this control on a page template and it renders fine when previewing/ viewing a page. There's some issue getting the SiteMapProvider in edit page mode, that's why the message "Object reference not set to an instance of an object.". Please try the provided control and tell me if it suits the desired functionality. I'll get back to you when I have updated information on the control displaying properly in page edit mode.
Thanks for the response. As I mentioned before, I altered the template that is normally used for the Navigation control.
Hi Richard Baugh,
We really appreciate your help on the forums, thanks a lot for the time spent sharing this information witheveryone while we are working on delivering a solution for the issue at hand. It's great to have customers actively participate sharing their solutions in this community resource, once again thank you.
All the best,
the Telerik team
In your solution where did you set the StartingNodeOffset to 1? Is it in the Advanced settings of the navigation control? I couldn't find that setting.
Thanks a bunch!
Hi Brett Winklesky,
I have replied to you in the support thread you have opened, you can check my response there. For your convenience I'm pasting my reply below:
"You should set the StartingNodeOffset in the SiteMapDataSource settings and then provide the ID of the SiteMapDataSource control as DataSource ID to a suitable RadControl (e.g. RadTreeView, RadMenu, RadTabStrip etc.)" If you need any additional information, please let us know.
the Telerik team
As you can see many are looking for the panel bar as a secondary navigation option.
Is there any change you can take all the code from the community programmers and have a panelbar solution build in sooner then Q2?
I forgot that I altered the NavigationControl also. Below is the code that I am using as my navigation control.