Navigate Up
Sign In
Supporters of Developer
Web

Add a Treeview to a Document LIbrary using SPTreeView and SPHierarchicalDataSource

Item is currently unrated. Press SHIFT+ENTER to rate this item.1 star selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+ESCAPE to leave rating submit mode.2 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.3 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.4 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.5 stars selected. Press SHIFT+ENTER to submit. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.

You may also be interested in: Smartdesk Advanced ECM Apps

 

Editor's note: Contributor Russell Gove is a Sharepoint Developer, Administrator, Architect and Trainer for a commodities trading company in Stamoford, CT.

To Add A treeview to a document library view, follow these steps:

1. Broswe to the view you want to add the treeview to.

2. Edit the page in SharePoint Designer — then Click Advanced Mode.

3. Add a tabnle to PlaceHolderMain with one row and Two Columns:


<table style=”width: 100%”>
   <tr valign=”top”>
    <td width=”20%”>
    </td>
    <td>
    </td>
   </tr>
</table>

4. Move the Existing Webpart Zone (the one that contains the view) and allits content to the second td you just added.

5. Add the following to the first TD you just added(the one whose width is 20%)


<SharePoint:SPHierarchyDataSourceControl id=”doclibDataSource” runat=”server” RootListId=”ff460d94-a778-426e-988f-487c654550de”
RootWebId=”6bb72437-8077-4b8c-b2ee-bf389ab08273″ ShowFolderChildren=”true” EnableViewState=”false”>
</SharePoint:SPHierarchyDataSourceControl>
<SharePoint:SPTreeView ID=”doclibtreeview” runat=”server” DataSourceID=”doclibDataSource” EnableViewState=”false” ExpandDepth=”2″
SelectedNodeStyle-CssClass=”ms-tvselected”>
</SharePoint:SPTreeView>

6. Change the RootListId attribute of the SPHierarchyDataSourceControl to whatever is in the ListID Attribute of the XsltListViewWebPart in the second TD.

7. Change the RootWebId attribute of the SPHierarchyDataSourceControl to the WebID of the Web the list is in (I used SharePoint manager to get the web ID)

2012-10-22-Treeview-01.png

Categories: dev; SharePoint Designer; MOSS; WSS; 2010

Comments

goophone x1

goophone x1

You can definitely see your enthusiasm in the paintings you write. The sector hopes for even more passionate writers such as you who aren't afraid to mention how they believe. All the time follow your heart. "Experience is a good school, but the fees are high." by Heinrich Heine.iNew i4000

Posted 07-Jul-2013 by goophone x1
NS

Thanks..

Thanks Russell.. it saved me alot..

Posted 09-Jul-2013 by NS
arthur

good point

But I just want to know what about right td?

Posted 17-Jul-2013 by arthur
Marek

An error...

Hello,
looks nice. However, I am getting an error and I have no idea how to solve this.
 
TreeView - doclibtreeviewError parsing control: Could not bind to the 'EncodedName' property (specified by TextField) while data binding TreeView. Please check the Bindings fields.

Posted 23-Sep-2013 by Marek
Ann

Treeview for lists

Hello, I want to make treeview for custon list. how to do it?

Posted 24-Oct-2013 by Ann
SPDev

Site collection name as top node

Hi, If my site name is portal and its url http://sp15 and now I want to have this site name "portal" on the top node then followed by its sub sites int sptreeview. How can I do this?

Posted 29-Jan-2014 by SPDev
Replica  Handbags

bags

There are various kinds of Replica Handbags UK in different materials and styles provided in the fashion industry. Replica Rolex Watches online are definitely your ideal everyday bag. Large and practical high qualityFake Louis Vuitton handbags are able to meet all your strict requirements. Buy replica Versace handbags cheap is essential no matter what the fashion weeks are focusing on. It's a wise choice to purchase replica Balenciaga handbags. The beauty of cheapHermes Designer Replica Handbags that you can always easily move yourReplica Designer Handbagsfrom bag also has relation with your dress.

Posted 02-Apr-2014 by Replica Handbags
alksdsajdksfs

alksdsajdksfs

Swiss watch brand Alpina Replica Watches continues development of its watches with the arrival at the end of the year Fake Breitling watches 2013, the Alpina Extreme Diver 1000 orange. Timer imposing 44 mm steel housing Replica Rolex uk water resistant 300 meters that houses the automatic mechanical gauge that displays its black dial particularly legible.

Posted 16-Apr-2014 by alksdsajdksfs

Notify me of comments to this article

E-mail:
   

Add Comment

Title:

 
Comment:
Email:

   


Name:

 
Url: