Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SPHierarchyDataSourceControl RootListId

$
0
0

Hi guys i have a Tree View WP , i want to use SPHierarchyDataSourceControl.RootListId to  root a specific list by ID.. This is my code but don t work.. Any idea?

            SPSite _MySite = SPContext.Current.Site;

            SPWeb _MyWeb = _MySite.OpenWeb();
            SPList list = _MyWeb.Lists["yourMailLibrary"];
            string RootID = list.ID.ToString();

            // Setup myDataSource to show only the Child webs
            SPHierarchyDataSourceControl myDataSource = new SPHierarchyDataSourceControl();
            myDataSource.ID = "myTreeViewDataSource";
            myDataSource.RootContextObject = "Web";
            myDataSource.RootListId = RootID;
            myDataSource.IncludeDiscussionFolders = false;
            myDataSource.ShowDocLibChildren = true;
            myDataSource.ShowFolderChildren = true;
            myDataSource.ShowListChildren = false;
            myDataSource.ShowWebChildren = false;
            Controls.Add(myDataSource);


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>