Hide/Show items

Jul 30, 2008 at 9:47 AM

I've been playing with the MultiMenu webcontrol and I think that is very robust and flexible. It's a good control to use and I want to thank you for it.

But there is one thing that I can't find.

How do I show/hide menu items depending of the user? I  mean, if the user is an Administrator or User or Guest,...

Thanks !

Aug 10, 2008 at 12:08 AM

Assign unique tags to all your items in the XML config and use the FindMenuItem(string tag) method to return the item you want to disable or make invisible. Use the Enable property to disable the item or use the Visible property to hide the item.

Oct 21, 2008 at 4:52 PM
Edited Oct 21, 2008 at 4:55 PM
Hi Bill.

My name is Javier, and like Xavier, I also find Your control very nice.
I'm trying to hide a MenuItem following your instructions, but can't make it work.

MultiMenuItem item = mnuMaster.FindMenuItem("admin");


if (item != null)
    item.Visible =

But the item is always false because the method FindMenuItem didn't find the Item.

This the line in the XML where the tag was assigned: (Line 10)

01    <MenuItem Text="Otros Gastos" PostBack="false">
02       <
MenuGroup Width="120" HorizontalOffset="10">
03            <
MenuItem Text="Registrar" Url="OtrosGastos.aspx"/>
04            <
MenuItem Text="Supervisor" ToolTip="Aprobaciones Supervisor" RightIcon="arrow_r.gif" PostBack="false" >
05                <
MenuGroup Width="120" ExpandDirection="Right" >
06                    <
MenuItem Text="Aprobar" Url="OAprobacionSuper.aspx" PostBack="True" />
07                    <
MenuItem Text="Ver Historia" ToolTip="Consultar Hist¢rico de Aprobaciones" Url="OHistoriaSuper.aspx" PostBack="True" />
08                </
09            </
10            <
MenuItem Text="Administrador" ToolTip="Aprobaciones Administrador" RightIcon="arrow_r.gif" PostBack="false" Tag="admin">
11                <
MenuGroup Width="120" ExpandDirection="Right" >
12                    <
MenuItem Text="Aprobar" Url="OAprobacionAdm.aspx" PostBack="True" />
13                    <
MenuItem Text="Ver Historia" ToolTip="Consultar Hist¢rico de Aprobaciones" Url="OHistoriaAdm.aspx" PostBack="True" />
14                </
15            </
16        </
17    </

Nov 11, 2008 at 8:31 PM
At what point in the page lifecycle are you using FindMenuItem? You might be calling it before the XML is loaded.