1

Closed

First Item not showing on Admin Menu

description

Hi There

I have found an Issue when creating a Menu item on the admin menu that the first item that you add does not appear in the child list of your menu items.

also the action asigned to the first child is then assigned to the top level navigation.
 public class AdminMenu : INavigationProvider {

        public Localizer T { get; set; }

        public string MenuName {
            get { return "admin";}
        }

        public void GetNavigation(NavigationBuilder builder) {
            builder.Add(T("Ranges"), "1", BuildMenu);
        }

        private void BuildMenu(NavigationItemBuilder menu) {

            menu.Add(T("List Ranges"), "2.2", item =>
                                     item.Action("List", "Admin", new { area = "Contents", id = "VehicleRange" }));

            menu.Add(T("New Range"), "2.3", item =>
                                      item.Action("Create", "Admin", new { area = "Contents", id = "VehicleRange" }));

            
        }
    }
When using this code my menu looks like this.

Ranges
  • New Range
The top level "Ranges" has the action of list.

As hack I did the following just to show the link on the menu.
 public class AdminMenu : INavigationProvider {

        public Localizer T { get; set; }

        public string MenuName {
            get { return "admin";}
        }

        public void GetNavigation(NavigationBuilder builder) {
            builder.Add(T("Ranges"), "1", BuildMenu);
        }

        private void BuildMenu(NavigationItemBuilder menu) {

            menu.Add(T("List Ranges"), "2.1", item =>
                                      item.Action("List", "Admin", new { area = "Contents", id = "VehicleRange" }));

            menu.Add(T("List Ranges"), "2.2", item =>
                                     item.Action("List", "Admin", new { area = "Contents", id = "VehicleRange" }));

            menu.Add(T("New Range"), "2.3", item =>
                                      item.Action("Create", "Admin", new { area = "Contents", id = "VehicleRange" }));

            
        }
    }
Thanks
Stanton
Closed May 14, 2013 at 7:57 PM by sebastienros

comments

CSADNT wrote May 9, 2013 at 3:12 PM

Stanton_R wrote May 10, 2013 at 6:38 AM

Cool thanks