Wednesday, July 17, 2013

SPHierarchyDataSourceControl changes is not reflecting in tree view control


You get a simple requirement
Hide some of the components from Tree view control of SharePoint 2010. ( Though hiding specific items is still not supported out of box and you probably will have to use custom tree view control)

Solution:
Make changes to master page specifically to node "SPHierarchyDataSourceControl "

You can add following properties:
IncludeDiscussionFolders="false"
ShowDocLibChildren="false"
ShowFolderChildren="false"
ShowListChildren="false"


You make changes and refresh page to see the change and to your surprise tree view doesn't change at all and still showing all components. Now you feel changes in your blood pressure and probably thinking what shoud i do next ....


Well probably if you find this article you will save some some of artery damage due to high pressure :-).

Details are give in below link
http://support.microsoft.com/kb/2558891

In nutshell, SharePoint 2010 feature(Metadata Navigation and Filtering Feature)  generally overrides your master page settings, To get this working change the ControlId of Delegate Control that wraps the SPHierarchyDataSourceControl from TreeViewAndDataSource to    TreeViewAndDataSourceCustom.


Relief!!!