Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:59:01+00:00 2026-06-14T22:59:01+00:00

I am using SharePoint Foundation 2010 and I would like to create a multilevel

  • 0

I am using SharePoint Foundation 2010 and I would like to create a multilevel navigation. (Similar to what the publishing site allows in SharePoint Standard. I realize that this could probably be built using a custom sitemap provider, which I have looked into.

The kicker here, is that I would like for it only show the pages and sites in which the logged in user has permissions to.

Currently, I have began developing a web part. Inside this web part I have written some c# code to loop through and get all the sites and subpages ( and check if the user has permissions) and then add them to a label. Eventually I would like to add them to either an asp:menu or create a and then use some css or jquery to manipulate it to do the drop down features.

Here is some of my code:

using (SPWeb oWebsite = new SPSite(webUrl).OpenWeb())
        {
            SPWebCollection collWebsite = oWebsite.Webs;

            foreach (SPWeb subSite in collWebsite)
            {
                if (subSite.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser.LoginName, SPBasePermissions.Open))
                {
                    Label1.Text += SPEncode.HtmlEncode(subSite.Title) + "<BR>";
                }

                SPList pagelist = subSite.Lists["Site Pages"];

                foreach (SPListItem item in pagelist.Items)
                {
                    if (item.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser, SPBasePermissions.Open))
                                            {
                        Label1.Text += item.Name + "<BR>";
                    }
                }

                Label1.Text += "<BR><BR>";

                subSite.Close();
            }

            Label1.Text += "<BR><BR><BR><BR>";
        }

    }

Instead of adding the site or page to the label, here is where I would like to create the list. The ultimate goal would be to place this web part onto the masterpage and allow for it to give the users some navigation based on permissions.

I also found some css to allow the multilevel navigation to work by adding elements simply as a

  • inside of an The only issue here is that once I placed this onto the masterpage, The 2nd level displayed when I hovered over the first item, but would disappear upon moving my mouse there. (This worked great when the webpart was placed onto a page itself)

    Am I on the right track here or is there another method that may work just as well or even better?

    TIA.

    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-06-14T22:59:02+00:00Added an answer on June 14, 2026 at 10:59 pm
       SPSecurity.RunWithElevatedPrivileges(delegate
                {
      
              SPSite oSiteCollection = SPContext.Current.Site;
      
              using (SPWeb oWebsite = new SPSite(webUrl).OpenWeb())
              {
                  SPWebCollection collWebsite = oWebsite.Webs;
      
                  foreach (SPWeb subSite in collWebsite)
                  {
                      var newItem = new MenuItem();
                      if (subSite.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser.LoginName, SPBasePermissions.Open))
                      {
                          newItem.NavigateUrl = subSite.Url;
                          newItem.Text = SPEncode.HtmlEncode(subSite.Title);
                          newItem.Value = SPEncode.HtmlEncode(subSite.Title);
                      }
      
                      SPList pagelist = subSite.Lists["Site Pages"];
      
                      foreach (SPListItem item in pagelist.Items)
                      {
      
                          if (item.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser, SPBasePermissions.Open))
                          {
                              var subItem = new MenuItem();
                              subItem.Value = SPEncode.HtmlEncode(item.Name);
                              subItem.Text = SPEncode.HtmlEncode(item.Name);
                              subItem.NavigateUrl = item.Url;
                              newItem.ChildItems.Add(subItem);
                          }
      
                      }
      
                      mnNAv.Items.Add(newItem);
                      subSite.Close();
                 }
      
              }
      });
      
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    We are developing a system using SharePoint 2010 Foundataion. We would like to track
    I am using sharepoint 2010. And I want to create blog site, but i
    I'm using SharePoint 2010. I want to create new view for my list. The
    I would like to display an exchange calendar on our intranet using SharePoint or
    I am trying to build CMS using sharepoint foundation 2010 or drupal. We already
    I am using SharePoint Foundation (Sharepoint 2010) to develop a workflow in Visual Studio
    We are using SharePoint 2010 Foundation. We have an item in a list that
    i m using sharepoint webservice admin.asmx to create a site collection in my webapp
    I have just started using Sharepoint Foundation 2010 and I'm trying to write a
    I am using SharePoint Foundation 2010. There is a master page v4.master . I

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.