Hi
I would like to know if it are using the radmenu within the code below, because through this code that I set who has access to it.
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim dtMenuItems As New DataSet
Dim erro As Boolean = False
Dim mensagem As String = ""
Dim obj As New clsSistemaVistoria.Menu
dtMenuItems = obj.Buscar(erro, mensagem, 2, "", Session("ID_Usuario"))
For Each drMenuItem As Data.DataRow In dtMenuItems.Tables(0).Rows
If drMenuItem("ID_Menu").Equals(drMenuItem("ID_MenuPai")) Then
Dim mnuMenuItem As New MenuItem
mnuMenuItem.Value = drMenuItem("ID_Menu").ToString
mnuMenuItem.Text = drMenuItem("NM_Menu").ToString
If drMenuItem("Url_Menu").ToString.Trim <> "" Then
mnuMenuItem.NavigateUrl = drMenuItem("Url_Menu").ToString & "?Autorizacao=" & drMenuItem("TP_Acesso").ToString
Else
mnuMenuItem.Selectable = False
End If
mnuPrincipal.Items.Add(mnuMenuItem)
AddMenuItem(mnuMenuItem, dtMenuItems.Tables(0))
End If
Next
End If
End Sub
Private Sub AddMenuItem(ByRef mnuMenuItem As MenuItem, ByVal dtMenuItems As Data.DataTable)
For Each drMenuItem As Data.DataRow In dtMenuItems.Rows
If drMenuItem("ID_MenuPai").ToString.Equals(mnuMenuItem.Value) AndAlso _
Not drMenuItem("ID_Menu").Equals(drMenuItem("ID_MenuPai")) Then
Dim mnuNewMenuItem As New MenuItem
mnuNewMenuItem.Value = drMenuItem("ID_Menu").ToString
mnuNewMenuItem.Text = drMenuItem("NM_Menu").ToString
If drMenuItem("Url_Menu").ToString.Trim <> "" Then
mnuNewMenuItem.NavigateUrl = drMenuItem("Url_Menu").ToString & "?Autorizacao=" & drMenuItem("TP_Acesso").ToString
Else
mnuMenuItem.Selectable = False
End If
mnuMenuItem.ChildItems.Add(mnuNewMenuItem)
AddMenuItem(mnuNewMenuItem, dtMenuItems)
End If
Next
For Each drMenuItem As Data.DataRow In dtMenuItems.Rows
Next
End Sub
I would like to know if it are using the radmenu within the code below, because through this code that I set who has access to it.
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim dtMenuItems As New DataSet
Dim erro As Boolean = False
Dim mensagem As String = ""
Dim obj As New clsSistemaVistoria.Menu
dtMenuItems = obj.Buscar(erro, mensagem, 2, "", Session("ID_Usuario"))
For Each drMenuItem As Data.DataRow In dtMenuItems.Tables(0).Rows
If drMenuItem("ID_Menu").Equals(drMenuItem("ID_MenuPai")) Then
Dim mnuMenuItem As New MenuItem
mnuMenuItem.Value = drMenuItem("ID_Menu").ToString
mnuMenuItem.Text = drMenuItem("NM_Menu").ToString
If drMenuItem("Url_Menu").ToString.Trim <> "" Then
mnuMenuItem.NavigateUrl = drMenuItem("Url_Menu").ToString & "?Autorizacao=" & drMenuItem("TP_Acesso").ToString
Else
mnuMenuItem.Selectable = False
End If
mnuPrincipal.Items.Add(mnuMenuItem)
AddMenuItem(mnuMenuItem, dtMenuItems.Tables(0))
End If
Next
End If
End Sub
Private Sub AddMenuItem(ByRef mnuMenuItem As MenuItem, ByVal dtMenuItems As Data.DataTable)
For Each drMenuItem As Data.DataRow In dtMenuItems.Rows
If drMenuItem("ID_MenuPai").ToString.Equals(mnuMenuItem.Value) AndAlso _
Not drMenuItem("ID_Menu").Equals(drMenuItem("ID_MenuPai")) Then
Dim mnuNewMenuItem As New MenuItem
mnuNewMenuItem.Value = drMenuItem("ID_Menu").ToString
mnuNewMenuItem.Text = drMenuItem("NM_Menu").ToString
If drMenuItem("Url_Menu").ToString.Trim <> "" Then
mnuNewMenuItem.NavigateUrl = drMenuItem("Url_Menu").ToString & "?Autorizacao=" & drMenuItem("TP_Acesso").ToString
Else
mnuMenuItem.Selectable = False
End If
mnuMenuItem.ChildItems.Add(mnuNewMenuItem)
AddMenuItem(mnuNewMenuItem, dtMenuItems)
End If
Next
For Each drMenuItem As Data.DataRow In dtMenuItems.Rows
Next
End Sub