Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Any idea to hide non-site items in the Sharepoint 2010 tree view control? Or the only chance is to develop our own control and integrate it on the master page?

there's this link but it doesn't seems so quite simple.

ideas?

Updated: Actually it works fine in masterpages, but only in blank sites. anyone knows why?

share|improve this question
    
what exactly do you want to display/hide.. the article looks simple enough. –  Ashish Patel Jan 26 '12 at 14:51
    
hide all site content in tree view control, leaving only the inherent Sites and Subsites below it. –  fallout Jan 26 '12 at 15:40
    
check my answer below –  Ashish Patel Jan 26 '12 at 16:14
add comment

1 Answer

up vote 4 down vote accepted

If you want to just show Sites and Subsites below it, you can setup the Data Source like this:

 <SharePoint:SPHierarchyDataSourceControl runat="server" ID="TreeViewDataSource"  
        IncludeDiscussionFolders="false" ShowListChildren="false" ShowDocLibChildren="false"
        ShowFolderChildren="false" RootContextObject="Web" />

And use above data source with the treeview as shown below:

  <SharePoint:SPTreeView runat="server" ID="WebTreeView" ShowLines="false" DataSourceID="TreeViewDataSource"
        ExpandDepth="0" SelectedNodeStyle-CssClass="ms-tvselected" NodeStyle-CssClass="ms-navitem"
        NodeStyle-HorizontalPadding="2" SkipLinkText="" NodeIndent="12" ExpandImageUrl="/_layouts/images/MDNCollapsed.png"
        ExpandImageUrlRtl="/_layouts/images/tvclosedrtl.png" CollapseImageUrl="/_layouts/images/MDNExpanded.png"
        CollapseImageUrlRtl="/_layouts/images/tvopenrtl.png" NoExpandImageUrl="/_layouts/images/tvblank.gif"
        AutoExpandSelectedNode="true">

    </SharePoint:SPTreeView>

I tested above in custom application page and it apperas as below:

enter image description here

share|improve this answer
    
It works, for real. thanks. But actually I was trying to get the same result throw the masterpage and that is what I'm not getting to. –  fallout Jan 30 '12 at 8:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.