This is a migrated thread and some comments may be shown as answers.

[Solved] Empty submenu with authorization

0 Answers 30 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
shashi sadasivan
Top achievements
Rank 1
shashi sadasivan asked on 23 Apr 2011, 09:13 AM
I have created a submenu for Admin users, and would like the submenu to be hidden, if the logged in user is not an administrator.

at the moment, the submenu items are hidden however, the menu containing the authorized menu items still shows up. Is there a way to hide a submenu if there are no items within it?

@(Html.Telerik().Menu()
                    .Name("menu")
                    .Items(menu => {
                        menu.Add().Text("Home").Action("Index", "Home");
                        menu.Add().Text("About").Action("About", "Home");
                        menu.Add().Text("Users").Action("Index", "User");
                        menu.Add().Text("Admin").Items(adminMenu =>
                        {
                            adminMenu.Add().Text("Users").Action("Index", "User");
                            adminMenu.Add().Text("View messages").Action("Index", "AdminMessages");
                        }).Enabled(false);
                    }))
Tags
Menu
Asked by
shashi sadasivan
Top achievements
Rank 1
Share this question
or