Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim grupo As Integer
grupo = CType(Session("grupoUsuario"), Integer)
' Create a new Menu control.
Dim newMenu As New Menu()
'Set the properties of the Menu control.
newMenu.ID = "NavigationMenu"
newMenu.CssClass = "menu"
newMenu.Orientation = Orientation.Horizontal
newMenu.EnableViewState = "false"
newMenu.IncludeStyleBlock = "false"
' Create the root menu item.
Dim homeMenuItem1 As MenuItem
Dim homeMenuItem2 As MenuItem
Dim homeMenuItem3 As MenuItem
Dim homeMenuItem4 As MenuItem
Dim homeMenuItem5 As MenuItem
If grupo = 1 Then
' Create the menu structure.
homeMenuItem1 = CreateMenuItem("PÁGINA PRINCIPAL", "~/PaginaPrincipal.aspx", "PÁGINA PRINCIPAL")
homeMenuItem2 = CreateMenuItem("LIQUIDACIÓN DE GASTOS", "~/Gastos/HojaLiquidacionGastos.aspx", "LIQUIDACIÓN DE GASTOS")
homeMenuItem3 = CreateMenuItem("VISAS", "~/Gastos/Visas.aspx", "VISAS")
homeMenuItem4 = CreateMenuItem("VALIDAR / RECHAZAR", "~/Validar-Rechazar/Identificador.aspx", "VALIDAR / RECHAZAR")
homeMenuItem5 = CreateMenuItem("LOGOUT", "~/Login.aspx", "LOGOUT")
' Add the root menu item to the ItemsCollection
' of the Menu control.
newMenu.Items.Add(homeMenuItem1)
newMenu.Items.Add(homeMenuItem2)
newMenu.Items.Add(homeMenuItem3)
newMenu.Items.Add(homeMenuItem4)
newMenu.Items.Add(homeMenuItem5)
ElseIf grupo = 2 Then
' Create the menu structure.
homeMenuItem1 = CreateMenuItem("PÁGINA PRINCIPAL", "~/PaginaPrincipal.aspx", "PÁGINA PRINCIPAL")
homeMenuItem3 = CreateMenuItem("VISAS", "~/Gastos/Visas.aspx", "VISAS")
homeMenuItem5 = CreateMenuItem("LOGOUT", "~/Login.aspx", "LOGOUT")
' Add the root menu item to the ItemsCollection
' of the Menu control.
newMenu.Items.Add(homeMenuItem1)
newMenu.Items.Add(homeMenuItem3)
newMenu.Items.Add(homeMenuItem5)
ElseIf grupo = 3 Then
' Create the menu structure.
homeMenuItem1 = CreateMenuItem("PÁGINA PRINCIPAL", "~/PaginaPrincipal.aspx", "PÁGINA PRINCIPAL")
homeMenuItem2 = CreateMenuItem("LIQUIDACIÓN DE GASTOS", "~/Gastos/HojaLiquidacionGastos.aspx", "LIQUIDACIÓN DE GASTOS")
homeMenuItem5 = CreateMenuItem("LOGOUT", "~/Login.aspx", "LOGOUT")
' Add the root menu item to the ItemsCollection
' of the Menu control.
newMenu.Items.Add(homeMenuItem1)
newMenu.Items.Add(homeMenuItem2)
newMenu.Items.Add(homeMenuItem5)
End If
' Add the Menu control to the Controls collection
' of the PlaceHolder control.
MenuPlaceHolder.Controls.Add(newMenu)
End Sub
Function CreateMenuItem(ByVal text As String, ByVal url As String, ByVal toolTip As String) As MenuItem
' Create a new MenuItem object.
Dim menuItem As New MenuItem()
' Set the properties of the MenuItem object using
' the specified parameters.
menuItem.Text = text
menuItem.NavigateUrl = url
menuItem.ToolTip = toolTip
Return menuItem
End Function
End Class