Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0New Menu ProviderNew Menu Provider
Previous
 
Next
New Post
1/7/2009 12:12 AM
 

 I get this error every time amd I cannot figure it out. Can anyone help?

An error has occurred.
DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DNNSEO.Web.UI.WebControls.SEOMenu.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Control.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at ASP.portals__default_skins_minimalextropy_index_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Control.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Control.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.Htmlform.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.HtmlControls.Htmlform.Render(HtmlTextWriter output) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.HtmlControls.Htmlform.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at ASP.default_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at DotNetNuke.Framework.PageBase.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

 

code for provider:

Imports DotNetNuke.UI.WebControls
Imports System.Web.UI.WebControls
Imports DNNSEO.Web.UI.WebControls
Imports DotNetNuke.UI.Skins
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.UI
Imports DotNetNuke.Modules.NavigationProvider
Imports System.Web.UI
Imports DotNetNuke.UI.Navigation
Imports System.IO
Imports System.Web
Imports DotNetNuke.Entities.Portals
Imports DotNetNuke.Common
Imports DotNetNuke.Framework.Providers

Namespace DotNetNuke.NavigationControl
    Public Class SEOMenuNavigationProvider
        Inherits DotNetNuke.Modules.NavigationProvider.NavigationProvider
        Private m_objMenu As SEOMenu
        Private m_strControlID As String
        Private m_strCSSBreadCrumbSub As String
        Private m_strIndicateChildImageBreadCrumbSub As String
        Private m_strIndicateChildImageBreadCrumbRoot As String
        Private m_strCSSBreadCrumbRoot As String

        Private m_strCSSLeftSeparator As String
        Private m_strCSSLeftSeparatorBreadCrumb As String
        Private m_strCSSLeftSeparatorSelection As String
        Private m_strCSSRightSeparator As String
        Private m_strCSSRightSeparatorBreadCrumb As String
        Private m_strCSSRightSeparatorSelection As String
        Private m_strNodeSelectedSub As String
        Private m_strNodeSelectedRoot As String
        Private m_strCSSNodeRoot As String
        Private m_strCSSNodeHoverSub As String
        Private m_strCSSNodeHoverRoot As String
        Private m_strCSSSeparator As String
        Private m_strNodeLeftHTMLSub As String = ""
        Private m_strNodeLeftHTMLBreadCrumbSub As String = ""
        Private m_strNodeLeftHTMLBreadCrumbRoot As String = ""
        Private m_strNodeLeftHTMLRoot As String = ""
        Private m_strNodeRightHTMLSub As String = ""
        Private m_strNodeRightHTMLBreadCrumbSub As String = ""
        Private m_strNodeRightHTMLBreadCrumbRoot As String = ""
        Private m_strNodeRightHTMLRoot As String = ""
        Private m_strSeparatorHTML As String = ""
        Private m_strSeparatorLeftHTML As String = ""
        Private m_strSeparatorLeftHTMLBreadCrumb As String = ""
        Private m_strSeparatorLeftHTMLActive As String = ""
        Private m_strSeparatorRightHTML As String = ""
        Private m_strSeparatorRightHTMLBreadCrumb As String = ""
        Private m_strSeparatorRightHTMLActive As String = ""
        Private m_blnIndicateChildren As Boolean
        Private m_strStyleRoot As String

        Public ReadOnly Property Menu() As SEOMenu
            Get
                Return m_objMenu
            End Get
        End Property
        Public Overrides ReadOnly Property NavigationControl() As System.Web.UI.Control
            Get
                Return Menu
            End Get
        End Property

        Public Overrides ReadOnly Property SupportsPopulateOnDemand() As Boolean
            Get
                Return False
            End Get
        End Property

        Public Overrides Property ControlID() As String
            Get
                Return m_strControlID
            End Get
            Set(ByVal Value As String)
                m_strControlID = Value
            End Set
        End Property

        Public Overrides Property CSSBreadCrumbSub() As String
            Get
                Return m_strCSSBreadCrumbSub
            End Get
            Set(ByVal Value As String)
                m_strCSSBreadCrumbSub = Value
            End Set
        End Property

        Public Overrides Property CSSBreadCrumbRoot() As String
            Get
                Return m_strCSSBreadCrumbRoot
            End Get
            Set(ByVal Value As String)
                m_strCSSBreadCrumbRoot = Value
            End Set
        End Property

        Public Overrides Property CSSLeftSeparator() As String
            Get
                Return m_strCSSLeftSeparator
            End Get
            Set(ByVal Value As String)
                m_strCSSLeftSeparator = Value
            End Set
        End Property

        Public Overrides Property CSSLeftSeparatorBreadCrumb() As String
            Get
                Return m_strCSSLeftSeparatorBreadCrumb
            End Get
            Set(ByVal Value As String)
                m_strCSSLeftSeparatorBreadCrumb = Value
            End Set
        End Property

        Public Overrides Property CSSLeftSeparatorSelection() As String
            Get
                Return m_strCSSLeftSeparatorSelection
            End Get
            Set(ByVal Value As String)
                m_strCSSLeftSeparatorSelection = Value
            End Set
        End Property

        Public Overrides Property CSSNodeSelectedSub() As String
            Get
                Return m_strNodeSelectedSub
            End Get
            Set(ByVal Value As String)
                m_strNodeSelectedSub = Value
            End Set
        End Property

        Public Overrides Property CSSNodeSelectedRoot() As String
            Get
                Return m_strNodeSelectedRoot
            End Get
            Set(ByVal Value As String)
                m_strNodeSelectedRoot = Value
            End Set
        End Property

        Public Overrides Property CSSNodeRoot() As String
            Get
                Return m_strCSSNodeRoot
            End Get
            Set(ByVal Value As String)
                m_strCSSNodeRoot = Value
            End Set
        End Property

        Public Overrides Property CSSNodeHoverSub() As String
            Get
                Return m_strCSSNodeHoverSub
            End Get
            Set(ByVal Value As String)
                m_strCSSNodeHoverSub = Value
            End Set
        End Property

        Public Overrides Property CSSNodeHoverRoot() As String
            Get
                Return m_strCSSNodeHoverRoot
            End Get
            Set(ByVal Value As String)
                m_strCSSNodeHoverRoot = Value
            End Set
        End Property

        Public Overrides Property CSSRightSeparator() As String
            Get
                Return m_strCSSRightSeparator
            End Get
            Set(ByVal Value As String)
                m_strCSSRightSeparator = Value
            End Set
        End Property

        Public Overrides Property CSSRightSeparatorBreadCrumb() As String
            Get
                Return m_strCSSRightSeparatorBreadCrumb
            End Get
            Set(ByVal Value As String)
                m_strCSSRightSeparatorBreadCrumb = Value
            End Set
        End Property

        Public Overrides Property CSSRightSeparatorSelection() As String
            Get
                Return m_strCSSRightSeparatorSelection
            End Get
            Set(ByVal Value As String)
                m_strCSSRightSeparatorSelection = Value
            End Set
        End Property

        Public Overrides Property CSSSeparator() As String
            Get
                Return m_strCSSSeparator
            End Get
            Set(ByVal Value As String)
                m_strCSSSeparator = Value
            End Set
        End Property

        Public Overrides Property IndicateChildren() As Boolean
            Get
                Return m_blnIndicateChildren
            End Get
            Set(ByVal Value As Boolean)
                m_blnIndicateChildren = Value
            End Set
        End Property

        Public Overrides Property NodeLeftHTMLSub() As String
            Get
                Return m_strNodeLeftHTMLSub
            End Get
            Set(ByVal Value As String)
                m_strNodeLeftHTMLSub = Value
            End Set
        End Property

        Public Overrides Property NodeLeftHTMLBreadCrumbSub() As String
            Get
                Return m_strNodeLeftHTMLBreadCrumbSub
            End Get
            Set(ByVal Value As String)
                m_strNodeLeftHTMLBreadCrumbSub = Value
            End Set
        End Property

        Public Overrides Property NodeLeftHTMLBreadCrumbRoot() As String
            Get
                Return m_strNodeLeftHTMLBreadCrumbRoot
            End Get
            Set(ByVal Value As String)
                m_strNodeLeftHTMLBreadCrumbRoot = Value
            End Set
        End Property

        Public Overrides Property NodeLeftHTMLRoot() As String
            Get
                Return m_strNodeLeftHTMLRoot
            End Get
            Set(ByVal Value As String)
                m_strNodeLeftHTMLRoot = Value
            End Set
        End Property

        Public Overrides Property NodeRightHTMLSub() As String
            Get
                Return m_strNodeRightHTMLSub
            End Get
            Set(ByVal Value As String)
                m_strNodeRightHTMLSub = Value
            End Set
        End Property

        Public Overrides Property NodeRightHTMLBreadCrumbSub() As String
            Get
                Return m_strNodeRightHTMLBreadCrumbSub
            End Get
            Set(ByVal Value As String)
                m_strNodeRightHTMLBreadCrumbSub = Value
            End Set
        End Property

        Public Overrides Property NodeRightHTMLBreadCrumbRoot() As String
            Get
                Return m_strNodeRightHTMLBreadCrumbRoot
            End Get
            Set(ByVal Value As String)
                m_strNodeRightHTMLBreadCrumbRoot = Value
            End Set
        End Property

        Public Overrides Property NodeRightHTMLRoot() As String
            Get
                Return m_strNodeRightHTMLRoot
            End Get
            Set(ByVal Value As String)
                m_strNodeRightHTMLRoot = Value
            End Set
        End Property

        Public Overrides Property SeparatorHTML() As String
            Get
                Return m_strSeparatorHTML
            End Get
            Set(ByVal Value As String)
                m_strSeparatorHTML = Value
            End Set
        End Property

        Public Overrides Property SeparatorLeftHTML() As String
            Get
                Return m_strSeparatorLeftHTML
            End Get
            Set(ByVal Value As String)
                m_strSeparatorLeftHTML = Value
            End Set
        End Property

        Public Overrides Property SeparatorLeftHTMLActive() As String
            Get
                Return m_strSeparatorLeftHTMLActive
            End Get
            Set(ByVal Value As String)
                m_strSeparatorLeftHTMLActive = Value
            End Set
        End Property

        Public Overrides Property SeparatorLeftHTMLBreadCrumb() As String
            Get
                Return m_strSeparatorLeftHTMLBreadCrumb
            End Get
            Set(ByVal Value As String)
                m_strSeparatorLeftHTMLBreadCrumb = Value
            End Set
        End Property

        Public Overrides Property SeparatorRightHTML() As String
            Get
                Return m_strSeparatorRightHTML
            End Get
            Set(ByVal Value As String)
                m_strSeparatorRightHTML = Value
            End Set
        End Property

        Public Overrides Property SeparatorRightHTMLActive() As String
            Get
                Return m_strSeparatorRightHTMLActive
            End Get
            Set(ByVal Value As String)
                m_strSeparatorRightHTMLActive = Value
            End Set
        End Property

        Public Overrides Property SeparatorRightHTMLBreadCrumb() As String
            Get
                Return m_strSeparatorRightHTMLBreadCrumb
            End Get
            Set(ByVal Value As String)
                m_strSeparatorRightHTMLBreadCrumb = Value
            End Set
        End Property

        Public Overrides Property StyleFontBold() As String
            Get
                Return Menu.Font.Bold.ToString
            End Get
            Set(ByVal Value As String)
                Menu.Font.Bold = CBool(Value)
            End Set
        End Property

        Public Overrides Property StyleFontSize() As Decimal
            Get
                Return CDec(Menu.Font.Size.Unit.Value)
            End Get
            Set(ByVal Value As Decimal)
                Menu.Font.Size = Web.UI.WebControls.FontUnit.Parse(Value.ToString)
            End Set
        End Property

        Public Overrides Property StyleRoot() As String
            Get
                Return m_strStyleRoot
            End Get
            Set(ByVal Value As String)
                m_strStyleRoot = Value
            End Set
        End Property

        Public Property MenuClientId() As String
            Get
                Return Me.Menu.MenuClientId
            End Get
            Set(ByVal value As String)
                Me.Menu.MenuClientId = value
            End Set
        End Property

        Public Overrides Property CSSControl() As String
            Get
                Return Me.Menu.CssClass
            End Get
            Set(ByVal Value As String)
                Me.Menu.CssClass = Value
            End Set
        End Property

        Public Overrides Sub Initialize()
            m_objMenu = New SEOMenu
            Menu.ID = m_strControlID
        End Sub

        Public Overrides Sub Bind(ByVal objNodes As DNNNodeCollection)
            Dim objNode As DotNetNuke.UI.WebControls.DNNNode = Nothing
            Dim menu As SEOMenu = Me.Menu
            menu.DataSource = Me.GetPageHierarchyData
            menu.DataTextField = "Name"
            menu.DataTitleField = "Description"
            menu.DataUrlField = "NavigateUrl"
            menu.DataBind()
            menu = Nothing
        End Sub

        Public Function GetPageHierarchyData() As IHierarchicalEnumerable
            Dim navigationNodes As DNNNodeCollection
            Dim enumerator As IEnumerator
            Dim enumerable2 As New NavDataPageHierarchicalEnumerable
            Dim intStartTabId As Integer = -1
            Dim attribute As CustomAttribute
            For Each attribute In Me.CustomAttributes
                Dim str As String = attribute.Name.ToLower
                If (str = "range") Then
                    intStartTabId = Conversions.ToInteger(attribute.Value.Trim)
                Else
                    If (str = "menuclientid") Then
                        Me.MenuClientId = attribute.Value
                        Continue For
                    End If
                    If (str = "leftcap") Then
                        Me.Menu.LeftCap = attribute.Value
                        Continue For
                    End If
                    If (str = "rightcap") Then
                        Me.Menu.RightCap = attribute.Value
                        Continue For
                    End If
                    If (str = "rootseparator") Then
                        Me.SeparatorHTML = attribute.Value
                        Continue For
                    End If
                    If (str = "subseparator") Then
                        Me.Menu.SubSeparator = attribute.Value
                        Continue For
                    End If
                    If (str = "rootdepth") Then
                        Me.Menu.RootDepth = Conversions.ToInteger(attribute.Value)
                        Continue For
                    End If
                    If (str = "maxdepth") Then
                        Me.Menu.MaxDepth = Conversions.ToInteger(attribute.Value)
                        Continue For
                    End If
                    If (str = "width") Then
                        Me.Menu.Width = Unit.Parse(attribute.Value)
                        Continue For
                    End If
                    If (str = "menurootbranchcssclass") Then
                        Me.Menu.RootBranchCssClass = attribute.Value
                        Continue For
                    End If
                    If (str = "menuitembranchcssclass") Then
                        Me.Menu.ItemBranchCssClass = attribute.Value
                        Continue For
                    End If
                    If (str = "menurootbreadcrumbcssclass") Then
                        Me.Menu.RootBreadcrumbCssClass = attribute.Value
                        Continue For
                    End If
                    If (str = "menuitembreadcrumbcssclass") Then
                        Me.Menu.ItemBreadcrumbCssClass = attribute.Value
                        Continue For
                    End If
                    If (str = "menuitemcurrentcssclass") Then
                        Me.Menu.ItemCurrentCssClass = attribute.Value
                    End If
                End If
            Next
            Select Case intStartTabId
                Case -2
                    Dim branchStart As Integer = Me.GetBranchStart(Me.PortalSettings.ActiveTab.TabID)
                    navigationNodes = Navigation.GetNavigationNodes("", ToolTipSource.Title, branchStart, -1, 0)
                    Exit Select
                Case -1
                    navigationNodes = Navigation.GetNavigationNodes("")
                    Exit Select
                Case 0
                    navigationNodes = Navigation.GetNavigationNodes("", ToolTipSource.Title, Me.PortalSettings.ActiveTab.TabID, -1, 0)
                    Exit Select
                Case Else
                    navigationNodes = Navigation.GetNavigationNodes("", ToolTipSource.Title, intStartTabId, -1, 0)
                    Exit Select
            End Select
            Try
                enumerator = navigationNodes.GetEnumerator
                Do While enumerator.MoveNext
                    Dim current As DNNNode = DirectCast(enumerator.Current, DNNNode)
                    enumerable2.Add(New NavDataPageHierarchyData(current))
                Loop
            Finally
                If TypeOf enumerator Is IDisposable Then
                    TryCast(enumerator, IDisposable).Dispose()
                End If
            End Try
            Return enumerable2
        End Function

        Private Function GetBranchStart(ByVal currentId As Integer) As Integer
            Dim num As Integer
            Dim controller As New TabController
            Dim info As TabInfo = controller.GetTab(currentId, Me.PortalSettings.PortalId, True)
            Dim info2 As TabInfo = controller.GetTab(info.ParentId, Me.PortalSettings.PortalId, True)
            If (info2 Is Nothing) Then
                Return info.TabID
            End If
            Me.GetBranchStart(info2.TabID)
            Return num
        End Function

        Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        End Sub

    End Class
End Namespace
 

Code for Menu:

Imports System.Web.UI.WebControls
Imports System.Web.UI
Imports System.Web.UI.HtmlControls

Namespace DNNSEO.Web.UI.WebControls
    Public Class SEOMenu
        Inherits HierarchicalDataBoundControl

#Region "Member Variables"
        Private _currentPath As String
        Private _isBreadcrumb As Boolean
        Private _menu As HtmlGenericControl
        Private _menuHtml As String
        Private _rootMenuItem As MenuItem
        Private _totalCount As Integer
#End Region

#Region "General"

        Public Property DataBreadcrumbField() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("DataBreadcrumbField"))
                If (str2 Is Nothing) Then
                    Return String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("DataBreadcrumbField") = value
                If Me.Initialized Then
                    Me.OnDataPropertyChanged()
                End If
            End Set
        End Property

        Public Property DataTargetField() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("DataTargetField"))
                If (str2 Is Nothing) Then
                    Return String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("DataTargetField") = value
                If Me.Initialized Then
                    Me.OnDataPropertyChanged()
                End If
            End Set
        End Property

        Public Property DataTextField() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("DataTextField"))
                If (str2 Is Nothing) Then
                    Return String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("DataTextField") = value
                If Me.Initialized Then
                    Me.OnDataPropertyChanged()
                End If
            End Set
        End Property

        Public Property DataTitleField() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("DataTitleField"))
                If (str2 Is Nothing) Then
                    Return String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("DataTitleField") = value
                If Me.Initialized Then
                    Me.OnDataPropertyChanged()
                End If
            End Set
        End Property

        Public Property DataUrlField() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("DataUrlField"))
                If (str2 Is Nothing) Then
                    Return String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("DataUrlField") = value
                If Me.Initialized Then
                    Me.OnDataPropertyChanged()
                End If
            End Set
        End Property

        Public Property ItemBranchCssClass() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("ItemBranchCssClass"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("ItemBranchCssClass") = value
            End Set
        End Property

        Public Property ItemBreadcrumbCssClass() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("ItemBreadcrumbCssClass"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("ItemBreadcrumbCssClass") = value
            End Set
        End Property

        Public Property ItemCurrentCssClass() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("ItemCurrentCssClass"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("ItemCurrentCssClass") = value
            End Set
        End Property

        Public Property LeftCap() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("LeftCap"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("LeftCap") = value
            End Set
        End Property

        Public Property MaxDepth() As Integer
            Get
                Dim num As Integer
                If Not Integer.TryParse(Conversions.ToString(Me.v13wstat3.Item("MaxDepth")), num) Then
                    num = -1
                End If
                Return num
            End Get
            Set(ByVal value As Integer)
                Me.v13wstat3.Item("MaxDepth") = value
            End Set
        End Property

        Public Property MenuClientId() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("MenuClientId"))
                If (str2 Is Nothing) Then
                    str2 = "DefaultCssMenu"
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("MenuClientId") = value
            End Set
        End Property

        Public Property RightCap() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("RightCap"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("RightCap") = value
            End Set
        End Property

        Public Property RootBranchCssClass() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("RootBranchCssClass"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("RootBranchCssClass") = value
            End Set
        End Property

        Public Property RootBreadcrumbCssClass() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("RootBreadcrumbCssClass"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("RootBreadcrumbCssClass") = value
            End Set
        End Property

        Public Property RootDepth() As Integer
            Get
                Dim num As Integer
                If Not Integer.TryParse(Conversions.ToString(Me.v13wstat3.Item("RootDepth")), num) Then
                    num = 0
                End If
                Return num
            End Get
            Set(ByVal value As Integer)
                Me.v13wstat3.Item("RootDepth") = value
            End Set
        End Property

        Public ReadOnly Property RootMenuItem() As MenuItem
            Get
                If (Me._rootMenuItem Is Nothing) Then
                    Me._rootMenuItem = New MenuItem(String.Empty)
                End If
                Return Me._rootMenuItem
            End Get
        End Property

        Public Property RootSeparator() As String
            Get
                Dim str2 As String = Conversions.ToString(Me.v13wstat3.Item("RootSeparator"))
                If (str2 Is Nothing) Then
                    str2 = String.Empty
                End If
                Return str2
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("RootSeparator") = value
            End Set
        End Property

        Public Property ShowMenuItemTooltips() As Boolean
            Get
                Dim flag As Boolean = Conversions.ToBoolean(Me.v13wstat3.Item("ShowMenuItemTooltips"))
                If Not flag Then
                    flag = False
                End If
                Return flag
            End Get
            Set(ByVal value As Boolean)
                Me.v13wstat3.Item("ShowMenuItemTooltips") = value
            End Set
        End Property

        Public Property SubSeparator() As String
            Get
                Dim str As String = Conversions.ToString(Me.v13wstat3.Item("SubSeparator"))
                If (str Is Nothing) Then
                    str = String.Empty
                End If
                Return str
            End Get
            Set(ByVal value As String)
                Me.v13wstat3.Item("SubSeparator") = value
            End Set
        End Property

        Public Overrides Property Width() As Unit
            Get
                Width = MyBase.Width
                If Width.IsEmpty Then
                    Width = Unit.Pixel(&H90)
                End If
                Return Width
            End Get
            Set(ByVal value As Unit)
                MyBase.Width = value
            End Set
        End Property



#End Region
#Region "Rendering"
        Private Function RenderMenu(ByVal enumerable As IHierarchicalEnumerable, ByVal depth As Integer) As HtmlGenericControl
            Dim num2 As Integer
            Dim enumerator As IEnumerator = enumerable.GetEnumerator
            Dim enumerator2 As IEnumerator = enumerable.GetEnumerator
            Dim absoluteUri As String = Me.Page.Request.Url.AbsoluteUri
            Dim control As New HtmlGenericControl("ul")
            If (depth > Me.RootDepth) Then
                control.Style.Add("left", Me.Width.ToString)
                control.Style.Add("top", "0")
            ElseIf (depth = Me.RootDepth) Then
                control.Style.Add("float", "left")
                control.Style.Add("width", Me.Width.ToString)
                control.Style.Add("height", "auto")
                If (Me.MenuClientId.Length > 0) Then
                    control.Attributes.Add("id", Me.MenuClientId)
                Else
                    control.Attributes.Add("id", "DefaultCssMenu")
                End If
                If (Me.CssClass.Length > 0) Then
                    control.Attributes.Add("class", ("AvastoneCssMenu " & Me.CssClass))
                Else
                    control.Attributes.Add("class", "AvastoneCssMenu")
                End If
            End If
            Dim str2 As String = ("<!-- Depth: " & depth.ToString & " -->")
            Dim control9 As HtmlGenericControl = control
            control9.InnerHtml = (control9.InnerHtml & str2)
            If ((depth = Me.RootDepth) And (Me.LeftCap.Length > 0)) Then
                Dim child As New HtmlGenericControl("li")
                child.Attributes.Add("class", "leftCap")
                child.InnerHtml = Me.LeftCap
                control.Controls.Add(child)
            End If
            Try
                enumerator = enumerable.GetEnumerator
                Do While enumerator.MoveNext
                    Dim objectValue As Object = RuntimeHelpers.GetObjectValue(enumerator.Current)
                    num2 += 1
                Loop
            Finally
                If TypeOf enumerator Is IDisposable Then
                    TryCast(enumerator, IDisposable).Dispose()
                End If
            End Try
            Try
                enumerator2 = enumerable.GetEnumerator
                Do While enumerator2.MoveNext
                    Dim obj3 As Object = RuntimeHelpers.GetObjectValue(enumerator2.Current)
                    Dim hierarchyData As IHierarchyData = enumerable.GetHierarchyData(RuntimeHelpers.GetObjectValue(obj3))
                    If (Not hierarchyData Is Nothing) Then
                        Dim num As Integer
                        num += 1
                        Dim control5 As New HtmlGenericControl("li")
                        Dim control7 As New HtmlGenericControl
                        Dim control4 As New HtmlGenericControl("a")
                        Dim str6 As String = String.Empty
                        Dim str8 As String = String.Empty
                        Dim str7 As String = String.Empty
                        Dim str5 As String = String.Empty
                        Dim str3 As String = String.Empty
                        Dim list As New List(Of String)
                        If (Me.DataTextField.Length > 0) Then
                            str6 = DataBinder.GetPropertyValue(hierarchyData, Me.DataTextField, Nothing)
                        End If
                        If (Me.DataTitleField.Length > 0) Then
                            str7 = DataBinder.GetPropertyValue(hierarchyData, Me.DataTitleField, Nothing)
                        End If
                        If ((str7.Length = 0) AndAlso (Me.DataTextField.Length > 0)) Then
                            str7 = DataBinder.GetPropertyValue(hierarchyData, Me.DataTextField, Nothing)
                        End If
                        If (Me.DataUrlField.Length > 0) Then
                            str8 = DataBinder.GetPropertyValue(hierarchyData, Me.DataUrlField, Nothing)
                        End If
                        If (Me.DataTargetField.Length > 0) Then
                            str5 = (" target=""" & DataBinder.GetPropertyValue(hierarchyData, Me.DataTargetField, Nothing) & """")
                        End If
                        If depth <= Me.RootDepth Then
                            control5.Style.Add("width", "100%")
                        End If
                        If (hierarchyData.HasChildren AndAlso (depth < Me.MaxDepth)) Then
                            If (depth > Me.RootDepth) Then
                                If (Me.ItemBranchCssClass.Length > 0) Then
                                    list.Add(Me.ItemBranchCssClass)
                                End If
                            ElseIf (Me.RootBranchCssClass.Length > 0) Then
                                list.Add(Me.RootBranchCssClass)
                            End If
                            If Not Me.DesignMode Then
                                Dim children As IHierarchicalEnumerable = hierarchyData.GetChildren
                                If (Not children Is Nothing) Then
                                    control7 = Me.RenderMenu(children, (depth + 1))
                                End If
                            End If
                        End If
                        Try
                            If (DataBinder.GetPropertyValue(hierarchyData, "Type", Nothing).Contains("NavDataPageHierarchyData") And (Me.ItemCurrentCssClass.Length > 0)) Then
                                Dim num3 As Integer
                                Dim strArray As String() = DataBinder.GetPropertyValue(hierarchyData, "Path", Nothing).Split(New Char() {"\"c})
                                Dim str9 As String = Me.Page.Request.QueryString.Item("TabId")
                                Dim startIndex As Integer = (str8.IndexOf("/tabid/") + 7)
                                Dim index As Integer = str8.IndexOf("/", startIndex)
                                If (index > startIndex) Then
                                    num3 = (index - startIndex)
                                Else
                                    num3 = (str8.Length - startIndex)
                                End If
                                If (strArray(strArray.GetUpperBound(0)) = str9) Then
                                    Me._currentPath = DataBinder.GetPropertyValue(hierarchyData, "Path", Nothing)
                                    list.Add(Me.ItemCurrentCssClass)
                                ElseIf ((num3 > 0) And (Me._currentPath.Length > 0)) Then
                                    Dim str10 As String = str8.Substring(startIndex, num3)
                                    If (Array.IndexOf(Of String)(Me._currentPath.Split(New Char() {"\"c}), str10) > -1) Then
                                        list.Add(Me.RootBreadcrumbCssClass)
                                    End If
                                End If
                            End If
                        Catch exception1 As Exception
                            ProjectData.SetProjectError(exception1)
                            Dim exception As Exception = exception1
                            If (exception.Message.Contains("DataBinding: 'System.Web.SiteMapNode' does not contain a property with the name 'Type'") AndAlso absoluteUri.EndsWith(str8)) Then
                                list.Add(Me.ItemCurrentCssClass)
                            End If
                            ProjectData.ClearProjectError()
                        End Try
                        Dim str4 As String = str6
                        str4 = (str4.Replace(" ", "").Replace(",", "").Replace(".", "").Replace(";", "").Replace(":", "") & "_item")
                        control5.Attributes.Add("id", str4)
                        control4.Attributes.Add("href", str8)
                        control4.InnerText = str6
                        str3 = ""
                        If (list.Count > 0) Then
                            Dim str11 As String
                            For Each str11 In list
                                str3 = (str3 & str11 & " ")
                            Next
                            str3 = str3.Trim
                            control4.Attributes.Add("class", str3)
                        End If
                        If (str5.Length > 0) Then
                            control4.Attributes.Add("target", str5)
                        End If
                        If Me.ShowMenuItemTooltips Then
                            control4.Attributes.Add("title", str7)
                        End If
                        control5.Controls.Add(control4)
                        If (control7.Controls.Count > 0) Then
                            control5.Controls.Add(control7)
                        End If
                        control.Controls.Add(control5)
                        Dim control6 As New HtmlGenericControl("li")
                        If ((depth = Me.RootDepth) And (Me.RootSeparator.Length > 0)) Then
                            If (num < num2) Then
                                control6.Attributes.Add("class", "rootSeparator")
                                control6.InnerHtml = Me.RootSeparator
                                control.Controls.Add(control6)
                            End If
                        ElseIf (((depth > Me.RootDepth) And (Me.SubSeparator.Length > 0)) AndAlso (num < num2)) Then
                            control6.Attributes.Add("class", "subSeparator")
                            control6.InnerHtml = Me.SubSeparator
                            control.Controls.Add(control6)
                        End If
                    End If
                Loop
            Finally
                If TypeOf enumerator2 Is IDisposable Then
                    TryCast(enumerator2, IDisposable).Dispose()
                End If
            End Try
            If ((depth = Me.RootDepth) And (Me.RightCap.Length > 0)) Then
                Dim control8 As New HtmlGenericControl("li")
                control8.Attributes.Add("class", "rightCap")
                control8.InnerHtml = Me.RightCap
                control.Controls.Add(control8)
            End If
            Return control
        End Function

#End Region

#Region "Helper Functions"

        Public Sub New()
            Me._currentPath = String.Empty
        End Sub

        Private Function GetItemHtml(ByVal markup As String, Optional ByVal cssClass As String = "") As String
            If (markup.Length > 0) Then
                If (cssClass.Length > 0) Then
                    markup = String.Concat(New String() {"<li class=""", cssClass, """>", markup, "</li>"})
                    Return markup
                End If
                markup = ("<li>" & markup & "</li>")
            End If
            Return markup
        End Function

        Protected Overrides Sub PerformDataBinding()
            MyBase.PerformDataBinding()
            If (Me.IsBoundUsingDataSourceID OrElse (Not Me.DataSource Is Nothing)) Then
                Dim data As HierarchicalDataSourceView = Me.GetData(Me.RootMenuItem.DataPath)
                If (data Is Nothing) Then
                    Throw New InvalidOperationException("No view returned by data source control.")
                End If
                Dim enumerable As IHierarchicalEnumerable = data.Select
                If (Not enumerable Is Nothing) Then
                    Try
                        Me._menu = Me.RenderMenu(enumerable, 0)
                    Catch ex As Exception
                    End Try
                End If
            End If
        End Sub

        Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
            Me._menu.RenderControl(writer)
        End Sub

#End Region

    End Class

End Namespace
 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0New Menu ProviderNew Menu Provider


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out