This question is locked. New answers and comments are not allowed.
with the v2011.3.1115, the parent node is rendered when there's no children. With the code bellow, Commandes and Transmettre are shown but there's no submenu to show because the user have no Authorization.
i used this code in the pass to define the menu (taken from this forum) but its not working at 100% now. Transmettre is not rendered but Commandes are still there:
Html.Telerik().Menu()
.Name(
"Menu"
)
.Items(menu =>
{
menu.Add()
.Text(
"Commandes"
)
.Items(items =>
{
items.Add()
.Action(
"Index"
,
"Commandes"
,
new
{ area =
""
})
.Text(
"Liste"
);
items.Add()
.Text(
"Transmettre"
)
.Items(sousItems =>
{
sousItems.Add()
.Action(
"TransmettreCommandesClient"
,
"Commandes"
,
new
{ area =
""
})
.Text(
"Commande client"
);
sousItems.Add()
.Action(
"TransmettreCommandesFournisseur"
,
"Commandes"
,
new
{ area =
""
})
.Text(
"Commande fournisseur"
);
});
});
})
i used this code in the pass to define the menu (taken from this forum) but its not working at 100% now. Transmettre is not rendered but Commandes are still there:
.ItemAction(item =>
{
// Ce code sert à ne pas afficher le menu Parent si tous les enfants ne sont pas accessible
bool
hasAccessible =
true
;
foreach
(var children
in
item.Items)
{
hasAccessible =
false
;
if
(children.IsAccessible(navAuthorization, ViewContext))
{
hasAccessible =
true
;
break
;
}
}
item.Visible = hasAccessible;
})