View SharePoint Document library Yes, show hierarchy directory, you can click Back level

Source: Internet
Author: User
Tags urlencode

Big Head Text

Share, progress

View SharePoint Document library Yes, show hierarchy directory, you can click Return hierarchy in SharePoint 2013, the Documnet Library (document library) contains multi-tiered folders, when you go to a folder, return to the specified level (for example, back to the previous layer), Needs to be returned with the browser. Inconvenient to use, and the return of the browser, will cause some problems, not recommended for universal user use. To solve this problem, a directory structure can be implemented by accessing the document library with a URL parameter [RootFolder], which records the path. The [RootFolder] parameter is processed primarily. This is implemented using WebPart. Of course, JavaScript can also be implemented as follows, has entered the multi-layer folder: file path, each node behind can click, jump to the appropriate folder: Codebehind, as follows

protected void Page_Load (object sender, EventArgs e) {string folderurl = this.            page.request.querystring["RootFolder"]; if (string. IsNullOrEmpty (FolderUrl) = = False) {String url = this.                Page.Request.Url.AbsolutePath; var namevalues = httputility.parsequerystring (this.                Page.Request.QueryString.ToString ());                StringBuilder sb = new StringBuilder ();                string[] Arrstr = folderurl.split ('/');                int arrlength = Arrstr.length; String Folderctid = this.                page.request.querystring["Folderctid"]; String View = this.                page.request.querystring["View"]; string tab = this.                page.request.querystring["tab"]; String module = this.                page.request.querystring["module"];                     if (arrstr! = null && arrlength > 0) {for (int i = 0; i < arrlength; i++) {sTring name = Arrstr[i]; if (name. Length > 0) {string rootfoldervalue = folderurl.substring (0, Folderu Rl.                            LastIndexOf (name));                            Rootfoldervalue = rootfoldervalue + name + "/";                            Namevalues.set ("RootFolder", Rootfoldervalue); String newurl = URL + "?" + String.                                                 Format ("Rootfolder={0}&folderctid={1}&view={2}&tab={3}&module={4}", Httputility.urlencode (Rootfoldervalue), Folderctid, Httputility.urlencode (View), tab, Httputility.urlencode (Modu                            Le));                            if (i = = 1) {name = "root directory"; } sb.                            Append ("<a href=" + Newurl + ">" + name + "</a>");                     if (i! = arrLength-1) {           Sb.                            Append (">>"); }}}} Pathstr = sb.            ToString ();   }        }

View SharePoint Document library Yes, show hierarchy directory, you can click Back level

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.