Hi everybody my name is jean im building a custom menu for a dnn skin that im creating i have already build the user control that renders de menu items but i have a little problem with the menu, the problem consist in that when i log on into the site as a host it didn't render the HOST items in the menu just the admin list of items. Here is the code that im using to bind the menu items.
Public Sub BuildSiteMap2(ByVal PortalID As Integer)
Dim URL As String
Dim currentGroup As String
Dim lastGroup As String = ""
Me.ASPxMenu1.Items.Clear()
' add urls
Dim intURLs As Integer = 0
Dim objTabs As New TabController
Dim Tabs As ArrayList = objTabs.GetTabs(PortalID)
If Tabs.Count > 0 Then
For Each objTab As TabInfo In Tabs
If objTab.IsDeleted = False AndAlso objTab.DisableLink = False AndAlso objTab.IsVisible AndAlso objTab.TabType = TabType.Normal AndAlso ((Null.IsNull(objTab.StartDate) = True OrElse objTab.StartDate < Now) AndAlso (Null.IsNull(objTab.EndDate) = True OrElse objTab.EndDate > Now)) Then
' the crawler is an anonymous user therefore the site map will only contain publicly accessible pages
If PortalSecurity.IsInRoles(objTab.AuthorizedRoles) Then
SITEMAP_GROUPLOCATION = objTab.FullUrl.Split("/").Length - 4
Exit For
End If
End If
Next
Else
SITEMAP_GROUPLOCATION = 2
End If
'Crear grupos
For Each objTab As TabInfo In Tabs
If objTab.IsDeleted = False AndAlso objTab.DisableLink = False AndAlso objTab.IsVisible AndAlso objTab.TabType = TabType.Normal AndAlso ((Null.IsNull(objTab.StartDate) = True OrElse objTab.StartDate < Now) AndAlso (Null.IsNull(objTab.EndDate) = True OrElse objTab.EndDate > Now)) Then
' the crawler is an anonymous user therefore the site map will only contain publicly accessible pages
If PortalSecurity.IsInRoles(objTab.AuthorizedRoles) Then
If intURLs < SITEMAP_MAXURLS Then
intURLs += 1
currentGroup = objTab.FullUrl.Split("/")(SITEMAP_GROUPLOCATION)
'currentGroup = objTab.TabName
If currentGroup <> lastGroup Then
Me.ASPxMenu1.Items.Add(objTab.TabName, currentGroup, GetImgUrl(objTab.TabName))
lastGroup = currentGroup
End If
End If
End If
End If
Next
'Agregar items a los grupos
For Each objTab As TabInfo In Tabs
If objTab.IsDeleted = False AndAlso objTab.DisableLink = False AndAlso objTab.IsVisible AndAlso objTab.TabType = TabType.Normal AndAlso ((Null.IsNull(objTab.StartDate) = True OrElse objTab.StartDate < Now) AndAlso (Null.IsNull(objTab.EndDate) = True OrElse objTab.EndDate > Now)) Then
' the crawler is an anonymous user therefore the site map will only contain publicly accessible pages
If PortalSecurity.IsInRoles(objTab.AuthorizedRoles) Then
If intURLs < SITEMAP_MAXURLS Then
intURLs += 1
URL = objTab.FullUrl
currentGroup = URL.Split("/")(SITEMAP_GROUPLOCATION)
For i As Integer = 0 To ASPxMenu1.Items.Count - 1
If Me.ASPxMenu1.Items(i).Name = currentGroup Then
Me.ASPxMenu1.Items(i).Items.Add(objTab.TabName, objTab.TabName, GetImgUrl(objTab.TabName), URL)
Exit For
End If
Next
End If
End If
End If
Next
'Verificar si no tiene mas de una pagina para poner como default
For Each objTab As TabInfo In objTabs.GetTabs(PortalID)
If objTab.IsDeleted = False AndAlso objTab.DisableLink = False AndAlso objTab.IsVisible AndAlso objTab.TabType = TabType.Normal AndAlso ((Null.IsNull(objTab.StartDate) = True OrElse objTab.StartDate < Now) AndAlso (Null.IsNull(objTab.EndDate) = True OrElse objTab.EndDate > Now)) Then
' the crawler is an anonymous user therefore the site map will only contain publicly accessible pages
If PortalSecurity.IsInRoles(objTab.AuthorizedRoles) Then
If intURLs < SITEMAP_MAXURLS Then
intURLs += 1
URL = objTab.FullUrl
currentGroup = URL.Split("/")(SITEMAP_GROUPLOCATION)
If URL.ToLower.IndexOf(Request.Url.Host.ToLower) = -1 Then
URL = AddHTTP(Request.Url.Host) & URL
End If
For i As Integer = 0 To Me.ASPxMenu1.Items.Count - 1
If Me.ASPxMenu1.Items(i).Items.Count = 1 Then
Me.ASPxMenu1.Items(i).NavigateUrl = Me.ASPxMenu1.Items(i).Items(0).NavigateUrl
Me.ASPxMenu1.Items(i).Items.Clear()
Exit For
End If
'Me.ASPxMenu1.Groups(i).Expanded = False
Next
End If
End If
End If
Next
End Sub
Thanks in advance for the help that any of you guys can give.
Jean Carlos