Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. i want code to remove submenu

i want code to remove submenu

Scheduled Pinned Locked Moved C#
csharpvisual-studiojsonhelptutorial
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Azza ALbelushi
    wrote on last edited by
    #1

    i am working in designing website using C# in visual studio 2010... all my pages comes under one page which is a master page .The master page contain menu which will appear in all other pages.... my request is : 1- when the user of the system will login for example as admin then all menu will appear for him while the the rest users will be able to see all the menu with all submenu except the menu that list admin rule activity which will be appear if they login only as admin.... i try to use the following code but it show error on( NavigationMenu) please provide me with the write code if possible

    void Page_Load(Object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    // Retrieve the root menu item from the Items
    // collection of the Menu control.
    MenuItem homeMenuItem = NavigationMenu.Items[0];

      // Retrieve the Movie submenu item from the ChildItems
      // collection of the root menu item.
      MenuItem movieSubMenuItem = NavigationMenu.FindItem(@"Home\\Movies");
    
      // Remove the Movie submenu item.
      if (movieSubMenuItem != null)
      {
        homeMenuItem.ChildItems.Remove(movieSubMenuItem);
      }
    }
    

    }

    O A R 3 Replies Last reply
    0
    • A Azza ALbelushi

      i am working in designing website using C# in visual studio 2010... all my pages comes under one page which is a master page .The master page contain menu which will appear in all other pages.... my request is : 1- when the user of the system will login for example as admin then all menu will appear for him while the the rest users will be able to see all the menu with all submenu except the menu that list admin rule activity which will be appear if they login only as admin.... i try to use the following code but it show error on( NavigationMenu) please provide me with the write code if possible

      void Page_Load(Object sender, EventArgs e)
      {
      if (!IsPostBack)
      {
      // Retrieve the root menu item from the Items
      // collection of the Menu control.
      MenuItem homeMenuItem = NavigationMenu.Items[0];

        // Retrieve the Movie submenu item from the ChildItems
        // collection of the root menu item.
        MenuItem movieSubMenuItem = NavigationMenu.FindItem(@"Home\\Movies");
      
        // Remove the Movie submenu item.
        if (movieSubMenuItem != null)
        {
          homeMenuItem.ChildItems.Remove(movieSubMenuItem);
        }
      }
      

      }

      O Offline
      O Offline
      obalesu
      wrote on last edited by
      #2

      Can you send which error its giving. Thankst & Regards obalesu.n

      1 Reply Last reply
      0
      • A Azza ALbelushi

        i am working in designing website using C# in visual studio 2010... all my pages comes under one page which is a master page .The master page contain menu which will appear in all other pages.... my request is : 1- when the user of the system will login for example as admin then all menu will appear for him while the the rest users will be able to see all the menu with all submenu except the menu that list admin rule activity which will be appear if they login only as admin.... i try to use the following code but it show error on( NavigationMenu) please provide me with the write code if possible

        void Page_Load(Object sender, EventArgs e)
        {
        if (!IsPostBack)
        {
        // Retrieve the root menu item from the Items
        // collection of the Menu control.
        MenuItem homeMenuItem = NavigationMenu.Items[0];

          // Retrieve the Movie submenu item from the ChildItems
          // collection of the root menu item.
          MenuItem movieSubMenuItem = NavigationMenu.FindItem(@"Home\\Movies");
        
          // Remove the Movie submenu item.
          if (movieSubMenuItem != null)
          {
            homeMenuItem.ChildItems.Remove(movieSubMenuItem);
          }
        }
        

        }

        A Offline
        A Offline
        AmitGajjar
        wrote on last edited by
        #3

        don't shout... Remove bold font. it looks very rude.

        Thanks -Amit Gajjar (MinterProject)

        D 1 Reply Last reply
        0
        • A AmitGajjar

          don't shout... Remove bold font. it looks very rude.

          Thanks -Amit Gajjar (MinterProject)

          D Offline
          D Offline
          DanielSheets
          wrote on last edited by
          #4

          @AmitGajjar wrote:

          don't shout... Remove bold font. it looks very rude.

          This is a helpful response. I thought all USING ALL CAPS is considered "shouting". Now its bold text too? I find your mis-usage of punctuation and incomplete sentences rude.

          T 1 Reply Last reply
          0
          • D DanielSheets

            @AmitGajjar wrote:

            don't shout... Remove bold font. it looks very rude.

            This is a helpful response. I thought all USING ALL CAPS is considered "shouting". Now its bold text too? I find your mis-usage of punctuation and incomplete sentences rude.

            T Offline
            T Offline
            Tom Deketelaere
            wrote on last edited by
            #5

            Yeah Just imagine what THIS IS THEN :)

            D 1 Reply Last reply
            0
            • T Tom Deketelaere

              Yeah Just imagine what THIS IS THEN :)

              D Offline
              D Offline
              DanielSheets
              wrote on last edited by
              #6

              That must be a top of the lungs scream! haha

              A 1 Reply Last reply
              0
              • D DanielSheets

                That must be a top of the lungs scream! haha

                A Offline
                A Offline
                AmitGajjar
                wrote on last edited by
                #7

                :laugh:

                Thanks -Amit Gajjar (MinterProject)

                1 Reply Last reply
                0
                • A Azza ALbelushi

                  i am working in designing website using C# in visual studio 2010... all my pages comes under one page which is a master page .The master page contain menu which will appear in all other pages.... my request is : 1- when the user of the system will login for example as admin then all menu will appear for him while the the rest users will be able to see all the menu with all submenu except the menu that list admin rule activity which will be appear if they login only as admin.... i try to use the following code but it show error on( NavigationMenu) please provide me with the write code if possible

                  void Page_Load(Object sender, EventArgs e)
                  {
                  if (!IsPostBack)
                  {
                  // Retrieve the root menu item from the Items
                  // collection of the Menu control.
                  MenuItem homeMenuItem = NavigationMenu.Items[0];

                    // Retrieve the Movie submenu item from the ChildItems
                    // collection of the root menu item.
                    MenuItem movieSubMenuItem = NavigationMenu.FindItem(@"Home\\Movies");
                  
                    // Remove the Movie submenu item.
                    if (movieSubMenuItem != null)
                    {
                      homeMenuItem.ChildItems.Remove(movieSubMenuItem);
                    }
                  }
                  

                  }

                  R Offline
                  R Offline
                  Rockstar_
                  wrote on last edited by
                  #8

                  You can create two Menu controls one for public users and the another for admin. and based on login enable and disable the menu controls.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups